Skip to content
unsigned support for Kotlin via boxed types and unsigned operators
Branch: master
Clone or download
Latest commit ba1b5c2 Jul 18, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea jvmTarget = "11" Jul 18, 2019
.kotlintest slight gradle simplification Jul 15, 2019
gradle/wrapper bumped: Jul 11, 2019
kobalt Update Build.kt Jan 25, 2017
src bumped: Jul 11, 2019
.gitignore moving to JPMS Jul 10, 2019
.travis.yml trying fix travis (jdk usage) Jul 10, 2019
LICENSE Create LICENSE May 26, 2017 Update Jul 10, 2019
build.gradle jvmTarget = "11" Jul 18, 2019
gradlew up Nov 27, 2018
gradlew.bat up Nov 27, 2018
jitpack.yml jitpack ojdk11 Jul 16, 2019
kobaltw Build kotlin-unsigned with Kobalt. Jan 20, 2017
kobaltw.bat Build kotlin-unsigned with Kobalt. Jan 20, 2017
settings.gradle - upgraded to 1.1.2-eap-73 Apr 20, 2017


Build Status license Release Size Github All Releases Slack Status

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

Differences with kotlin stdlib:

  • 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 and shr for Ubyte and Ushort
  • if you add an Ushort to another Ushort you get an Ushort (and not an `Uint)
  • no unsigned arrays supported yet

How to get it:


  • Add it in your root build.gradle at the end of repositories:

    allprojects {
        repositories {
            maven { url '' } // should be the last entry
  • Add the dependency

    dependencies {
        compile 'com.github.kotlin-graphics:kotlin-unsigned:v2.1'

Maven, Sbt, Leiningen


Android compatible, sources compiled with java 1.7.

All unsigned methods available for ints and longs on java 1.8 have been reported here.

These are offered directly on the corresponding Int and Long Kotlin primitives (with infix too)


Don't hesitate to contribute to the project by submitting issues or pull requests for bugs and features. Any feedback is welcome at


You can’t perform that action at this time.