Skip to content

Conversation

@PXshadow
Copy link
Contributor

@PXshadow PXshadow commented Oct 6, 2021

UInt overflow system with Int64 functions such as toString/parseString. Underlying type of UInt64 is Int64, equivalent to UInt's underlying type being Int.

@skial skial mentioned this pull request Oct 6, 2021
1 task
@:from public static inline function ofInt(x:Int):UInt64
return Int64.ofInt(x);

@:to private #if (!js || analyzer) inline #end function toFloat():Float {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's with the #if (!js || analyzer)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found it at https://github.com/HaxeFoundation/haxe/blob/4.2.1/std/UInt.hx#L310 , Will remove toFloat though, because it's not in Int64 and I think it would have an imprecise output.

@RealyUniqueName RealyUniqueName added this to the Backlog milestone Oct 20, 2021
@AndrewDRX
Copy link

I'm struggling to figure out what happened to this request. Was it decided to not support 64-bit unsigned integers? Or is there another recommendation for working w/ that data type?

@Simn
Copy link
Member

Simn commented Feb 29, 2024

Looks like the branch was deleted?

@AndrewDRX
Copy link

Could be. I think today github has a more informative comment when a pull request is closed due to a deleted branch, but there might be some nuance here or maybe github added that more recently.

Can this be reopened? Or should I start fresh with a new Issue and Pull Request mentioning this one, porting over the work that was already done here, and then we can go from there?

@PXshadow
Copy link
Contributor Author

Hello I am the creator, if I remember correctly I think I deleted it as I thought I would make another pull request later. I still have the code for UInt64 I just need to write the unit tests and then I could send in a pull request. Would that work?

@AndrewDRX
Copy link

Sounds great! As long as you are fine doing that work (and if there wasn't any major reason why it couldn't be done). I will certainly use it whenever it becomes available.

@AndrewDRX
Copy link

AndrewDRX commented Mar 3, 2024

So... after digging into my my use case for requesting this, I might not need a 64-bit unsigned integer type after all.

My end goal is to have a Sha512 class added to to the haxe.crypto package, which I was under the impression that the unsigned type would be a prerequisite for this given BouncyCastle's .NET implementation of a SHA-512 digest using the ulong data type. However, I have just noticed that the Haxe implementation of the SHA-256 digest does NOT use unsigned integers, so a SHA-512 digest implementation can do the same, simply using the unsigned shift right operator where necessary.

Also, it would have made more sense for me to review BouncyCastle's Java implementations since they would obviously not have the availability of using unsigned integer types.

Still, I think it would be lovely to have the simulated UInt64 data type as part of the Haxe standard library, which could ideally be transpiled directly into native unsigned integer types for targets that support it (or at least into light-weight wrappers utilizing those native types). So, any work put into moving this closed pull request into a new pull request will not go unappreciated.

Aside from that, I will at least submit a new Issue to track an enhancement request for adding a SHA-512 implementation, and possibly work on a pull request for the implementation/tests.

@flashultra
Copy link
Contributor

flashultra commented Mar 3, 2024

@AndrewDRX About Sha512 implementation you can check this one : https://github.com/HaxeFoundation/crypto/blob/master/src/haxe/crypto/Sha512.hx
About UInt64 I did some proposals here HaxeFoundation/haxe-evolution#101 ( render version is here : https://github.com/flashultra/haxe-evolution/blob/master/proposals/0000-integer-data-types.md ) .
If you want to add anything, I would appreciate any comments that can improve things.

@AndrewDRX
Copy link

AndrewDRX commented Mar 3, 2024

Thanks! That is certainly what I was looking for regarding the hash implementations.

And I'll check out your proposals and comment if I think of anything worth mentioning.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants