``` infix fun Int.has(flag: Int) = this and flag =...
# stdlib
m
Copy code
infix fun Int.has(flag: Int) = this and flag == flag
infix fun Int.flagIf(condition: Boolean) = if (condition) this else 0
Haven't I reinvented a bicycle (or a wheel)? Or there's something similar in stdlib?
👍 1
l
miha-x64: I did a similar things I copy paste in my projects: https://gist.github.com/LouisCAD/04be811e22d45cbc7285ab247c6c12e7
👍 1
t
why are those inlined, out of curiosity?
l
@treelzebub Why wouldn't they be? They are really small methods, not worth adding more methods to the dex, plus the method calling overhead for a bits affair!
t
yup! good points
m
++ for
inline
, I want
@InlineOnly
to be public for such tiny utils.
2
k
@miha-x64 i.e. you want it to be non-
@InlineOnly
🤔 1
m
@kirillrakhman what? I want my tiny util-functions to be inline-only. (But it looks technically complicated.)
k
you can have
inline
functions that are not
@InlineOnly
then you can still call them from java
m
I have very little Java code in my codebase.
k
oh, I misunderstood