Unsigned operators and boxed types (Ubyte
, Uint
, Ulong
and Ushort
) for unsigned support.
To have a quick idea what this library offers, take a look at the tests
- this project uses classes instead inline classes. To address this in critical scenarios where allocations may have a sensitive impact, primitive variable holding the utype value is a
var
, so you can re-use the same istance over and over again - utypes extend
Number
abstract class - automatic conversions
- it is possible to string format by calling the corresponding
format()
method, eg:ubyte.format("%08x")
- all the utypes implement all the function, including
shl
andshr
forUbyte
andUshort
- if you add an
Ushort
to anotherUshort
you get anUshort
(and not anUint
)
-
Add it in your root build.gradle at the end of repositories:
allprojects { repositories { ... maven { url 'https://jitpack.io' } // should be the last entry } }
-
Add the dependency
dependencies { compile 'com.github.kotlin-graphics:kotlin-unsigned:v2.1' }
Don't hesitate to contribute to the project by submitting issues or pull requests for bugs and features. Any feedback is welcome at [email protected].
- inspired by jOOU