unsigned support for Kotlin via boxed types and unsigned operators

Overview

kotlin-unsigned

Build Status license Release Size Github All Releases

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)

Install:

With Gradle kx.util plugin, everything is nicely aligned and the boilerplate code is gone

plugins {
    id("kx.util") version "0.7.3+51"
}

dependencies {
    implementation(unsigned)
}
dependencies {
    implementation("kotlin.graphics:unsigned:3.3.1")
}

Be sure to have mary repository:

repositories {
   maven("https://raw.githubusercontent.com/kotlin-graphics/mary/master")
}

You can find all the instructions by mary

Contributions:

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].

Credits:

Deploys by Netlify
Comments
  • Can't build

    Can't build

     $ ./kobaltw
                _  __          _               _   _
               | |/ /   ___   | |__     __ _  | | | |_
               | ' /   / _ \  | '_ \   / _` | | | | __|
               | . \  | (_) | | |_) | | (_| | | | | |_
               |_|\_\  \___/  |_.__/   \__,_| |_|  \__|  0.914
    
    test {
    /tmp/kobalt4764927415381874370.kt:15:1 Expecting a top level declaration
    *****
    ***** ERROR Couldn't compile file: Expecting a top level declaration
    *****
    **** Version 0.916 is installed, you can switch to it with ./kobaltw --update
    
    opened by sirikid 4
  • Aren't unsigned numbers in kotlin 1.3.x already?

    Aren't unsigned numbers in kotlin 1.3.x already?

    Not using unsigned numbers myself I can't be sure of all that there is available or not, but Kotlin 1.3 covers unsigned numbers doesn't it? https://kotlinlang.org/docs/reference/whatsnew13.html#unsigned-integers

    opened by apatrida 3
  • Missing package in Long.kt file

    Missing package in Long.kt file

    opened by SerVB 3
  • Maintain a latest release compiled with stable version of Kotlin

    Maintain a latest release compiled with stable version of Kotlin

    It would be good to have one release with latest code that's compiled with stable Kotlin version. I can't use the latest release v2.4.2 with stable Kotlin version 1.1.51 as of now. Last release I can use is v2.3.

    opened by sachins 3
  • Extension operator functions for standard types

    Extension operator functions for standard types

    Hello!

    Is it possible to provide some extension operator functions for standard types? Something like operator fun Int.plus(x: Uint): Int.

    Now I have to write i + u.toInt() instead of i + u.

    opened by SerVB 2
  • Build kotlin-unsigned with Kobalt.

    Build kotlin-unsigned with Kobalt.

    I don't expect you to merge this, just showing you what your project looks like when built by Kobalt.

    Run with:

    ./kobaltw test

    Note that I renamed your test class from unsigned to UnsignedTest, otherwise Kobalt won't find it by default (you can configure the test runner to look at all the .class files but that might take a while, so by default, Kobalt only looks for **/*Test.class).

    Configuring your build to upload your project to bintray as a Maven artifact is just a few more lines, I can show you how if you're curious.

    opened by cbeust 2
  • No static method compareUnsigned(II)I

    No static method compareUnsigned(II)I

    I am getting the following error in my crash logs.

    java.lang.NoSuchMethodError: No static method compareUnsigned(II)I in class Ljava/lang/Integer; or its super classes (declaration of 'java.lang.Integer' appears in /system/framework/core-libart.jar)
            at unsigned.Ushort.compareTo(Ushort.kt:87)
    

    I'm not sure what this meant in the readme.

    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)
    

    It is crashing when I'm comparing two Ushorts using >=.

    opened by horsejockey 1
  • Rebase jdk8 branch

    Rebase jdk8 branch

    This PR does the same as https://github.com/kotlin-graphics/kool/pull/2:

    Rebases jdk8 onto master and changes the github actions JDK version to 8.

    Please note that the rebase leaves a non-linear commit history: let me know if you'd like a merge instead.

    opened by zeroeightysix 0
  • Removing Kobalt build script

    Removing Kobalt build script

    It looks like Kobalt build scripts are not maintained here, as they still mention vesion 0.1 while the library is already version 3.0.6, and they don't have much in comparison to Gradle ones. Also I don't see if Kobalt supports Kotlin multi-platform projects -- @cbeust, please let me know if I'm wrong. I don't see point in having two build systems in the project. So the question to library users is: does anybody have objections to removing Kobalt scripts? I'm open to discussions. If everyone is okay with this, I'll do that a bit later.

    opened by r4zzz4k 0
  • Provide Mutable and Immutable Utypes

    Provide Mutable and Immutable Utypes

    Now we can change var v so even val Utype is mutable. What about renaming currenty Utypes to MutableUtypes (like in Kotlin Notation) and providing Utypes with val that will be truly immutable? I will use those immutable classes.

    opened by SerVB 6
  • Operations for signed and unsigned integer types of 128, 192, 256 bits

    Operations for signed and unsigned integer types of 128, 192, 256 bits

    Theoretically these can be implemented via classes extending Number and based on several integer primitives. Currently all the stuff higher than 64 bits goes through BigInteger which is available in Kotlin/JVM only (which may be available in Kotlin stdlib some day). Please leave a comment if anybody needs these types and / or are willing to work on that -- this could be useful when multi-platform version of the library is available.

    opened by r4zzz4k 0
Releases(v3.2.9)
Owner
Friendly community providing JVM counterpart of open source tools for real time 3d graphic. "Take care of your tools and they will take care of you." (cit)
null
An application to create custom QR codes to specify waste types and waste disposal procedures for products.

wasteqr An application to create custom QR codes to specify waste types and waste disposal procedures for products. What is WasteQR? WasteQR is an app

Mihir Arya 1 May 24, 2022
A simple sample showing the different types of notifications on Andoid

Notification example Simple notification. Expandable notification Progress notification Action button notification Notifications: MainActivity: Refs h

Saul Molinero 191 Nov 29, 2022
Android cutout screen support Android P. Android O support huawei, xiaomi, oppo and vivo.

CutoutScreenSupport Android cutout screen support Android P. Android O support huawei, xiaomi, oppo and vivo. Usage whether the mobile phone is cutout

hacket 5 Nov 3, 2022
android-delicious Delicious Android is an Android app which helps you access and save bookmarks via Delicious. It's available over at Google Play.

Delicious Android Delicious Android is an Android app which helps you access and save bookmarks via Delicious. It's available over at Google Play. Fea

Alexander Blom 137 Nov 20, 2022
The app has got fullscreen Turkey map via Huawei Map. App selects random province and shows it borders on the map than user will try to guess the provinces name.

Il Bil App Introduction I will introduce you to how to implement Account Kit, Map Kit, Game Service. About the game: The app has got fullscreen Turkey

Gökhan YILMAZ 4 Aug 2, 2022
🐦 Loritta's Social media relayer via Discord Webhooks micro-service

?? SocialRelayer ?? SocialRelayer is a social media relayer to Discord via webhooks, pulling Loritta's guild configurations to automatically register

Loritta 6 Jun 2, 2022
Sending komq's latest YouTube & Twitch notifications via Twitter.

Komwitter Twitch & YouTube Notification Twitter Bot for komq. Used Libraries: Twitter4J Twitch4J Kotlinx.serialization and some other dependency libra

BaeHyeonWoo 4 Feb 10, 2022
This component allows you to interact with remote machine via SSH. You can execute commands or run scripts located on that machine

th2 act ssh (1.2.0) Overview Provides user with the ability to execute specified scripts or commands with the parameter he needs Custom resources for

th2 1 Dec 18, 2022
Pluck - Pluck, a library helps you to pick image via Galley/Camera built using Compose

Pluck - The image-picker library for Compose This is an image-picker for your je

Himanshu Singh 255 Jan 3, 2023
This project consists in the approach of a bakery business, in which the user can book one or more products (cakes), in addition to having the method of payment in cash (post-shipment) or the method of payment via mobile

This project consists in the approach of a bakery business, in which the user can book one or more products (cakes), in addition to having the method of payment in cash (post-shipment) or the method of payment via mobile

Paul Guillen Acuña 2 Dec 20, 2022
Play casual chess on lichess.org via voice commands

Lichess-by-Voice lichess.org is a cost-free, ad-free chess server. Lichess, as well as this app, is Open Source. The app connects to your Lichess acco

Ralf Stephan 14 Sep 7, 2022
An android & arduino project. The android app is used to control motors via Arduino.

Boccia ramp project An android & arduino project. The android app is used to control motors via Arduino. Description This project is made in the conte

vql 2 Jul 29, 2022
Bringing webhooks into Telegram. Push messages to chats via URL with a simple API.

Webhooks over Telegram (WoT) WoT aims to provide a simple API for registering webhooks and sending messages to Telegram chats via them using a single

d1s utils 2 Oct 5, 2022
Whitelist Player on Minecraft Server via Twitch Channel Points ✅

TwitchWhitelist This is a customisable 1.8-1.19 Spigot Plugin to Whitelist Players via Twitch Channel Points Rewards. Setup Setup a PaperMC (recommend

Jakob 3 Oct 17, 2022
AlarmIT is a simple alarm app. The alarms can be turned off via three methods - normal turnoff, by shaking the device a number of times, by solving maths questions.

Kicking Off Hacktoberfest with ACM-VIT! AlarmIT AlarmIT is a simple alarm app. The alarms can be turned off via three methods - normal turnoff, by sha

ACM VIT 6 Jan 3, 2023
Social media app but with new features like translate messages and posts , support video & images as posts , chat and notifications , etc...

social-media-app Social media app but with new features like translate messages and posts , support video & images as posts , chat and notifications ,

Kareem Aboelatta 15 Dec 13, 2022
A handy phone call manager with phonebook, number blocking and multi-SIM support

Simple Dialer A lightweight app for handling your calls, no matter where are you. Comes with a handy call log for easy call initiation. There is a qui

Simple Mobile Tools 443 Jan 6, 2023
Custom MediaPicker for Android. support targetSdk 30 & scoped storage. And use registerForActivityResult rather than onActivityResult.

MoongchiPicker What is MoongchiPicker? MoongchiPicker is custom media gallery base on Google's Material Design Bottom Sheets. You can fetch image or v

펫프렌즈 5 Nov 26, 2022
React Native Stone SDK Implementation (Support for both Mobile and POS versions)

react-native-stone-pos Stone Android POS Native Module Installation Stone has a private packageCloud repository, so we need to have your token before

8Sistemas 9 Dec 10, 2022