Comments (4)
Tried .toUnsignedString(2)
, toHexString()
as well, it's less 0s.
.toUlong().toString()
gives a good decimal representation, but I need binary; UType
s don't have toString(radix)
methods.
.toUlong().toBigInt().toString(2)
gives the right value, but pretty tedious.
.toUBigInt().toString(2)
is based on toUnsignedString(10)
, luckily that's not using toUnsignedString0
, so it works.
The bug is in the konversion of formatUnsignedLong
from the JDK: when you introduced _this
, you forgot to replace the implicit this.toInt() and mask
inside digits[]
, it should be _this.toInt() and mask
.
from kotlin-unsigned.
Hi Róbert,
thanks for opening the issue and suggesting the fix, I quickly applied it and it worked.
I'll review all the other call and problems you mentioned with calm.
Btw, push request are welcome for the next time if you want to do it directly.
Shall I publish a release for this fix?
from kotlin-unsigned.
The other issues are not really issues, I was just looking to work around this bug.
I guess the only thing you need to look at is "UTypes
don't have toString(radix)
methods."
No need to push any quick, I decided to just go with fun Int.toBinaryHashString() = java.lang.Integer.toBinaryString(this)
instead of pulling your whole lib in, I'm on desktop and targeting latest Java so have the API I need.
from kotlin-unsigned.
Added toString(radix)
in 1.3 branch
A little late but better than never :p
from kotlin-unsigned.
Related Issues (15)
- Fix primitive extension field HOT 1
- No static method compareUnsigned(II)I HOT 1
- Extension operator functions for standard types HOT 2
- Add Uint.equals(Int) HOT 2
- Missing package in Long.kt file HOT 3
- Provide Mutable and Immutable Utypes HOT 6
- Aren't unsigned numbers in kotlin 1.3.x already? HOT 3
- JitPack build failure for v3.3.32 HOT 1
- Probable missuse of Optin
- Can't build HOT 4
- License missing HOT 3
- Maintain a latest release compiled with stable version of Kotlin HOT 3
- Removing Kobalt build script
- Operations for signed and unsigned integer types of 128, 192, 256 bits
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kotlin-unsigned.