haxe icon indicating copy to clipboard operation
haxe copied to clipboard

Implement Int128 + its numeral literal suffix

Open SomeGuyWhoLovesCoding opened this issue 1 year ago • 20 comments

Everything in the pure haxe version is done but the issue is that Int128.mul(a, b) doesn't multiply properly with the value bigger than 1.8e19 which means the number will overflow. So, I was wondering if any of you could please fix that issue.

SomeGuyWhoLovesCoding avatar Aug 23 '24 21:08 SomeGuyWhoLovesCoding

I'm not sure if this is the right place to ask for help, the Issues tab might be more sufficient.

EyeDaleHim avatar Aug 24 '24 05:08 EyeDaleHim

Actually I prefer a PR here because it's easier to reason about the code and see the failing tests, so I think this is a good initiative.

Simn avatar Aug 24 '24 06:08 Simn

How come 14 tests failed?

SomeGuyWhoLovesCoding avatar Aug 24 '24 12:08 SomeGuyWhoLovesCoding

How come 14 tests failed?

That's what the details tab are for, perhaps you can click on them :P

EyeDaleHim avatar Aug 24 '24 13:08 EyeDaleHim

This is an error from linux build 4.08.1:

   - |   [...]
 126 | }
Type Int64Helper refined from class Int128Helper```

SomeGuyWhoLovesCoding avatar Aug 24 '24 13:08 SomeGuyWhoLovesCoding

Guess what? I fixed it with no effort just today. It was just that the mask was wrong. The multiply mask for Int64 is 0xFFFF (65535) so The multiply mask for Int128 should be 0xFFFFFFFF (4294967295).

SomeGuyWhoLovesCoding avatar Aug 24 '24 15:08 SomeGuyWhoLovesCoding

🤓

TheRealJake12 avatar Aug 24 '24 17:08 TheRealJake12

Just a quick question:

https://github.com/SomeGuyWhoLovesCoding/haxe-int128/blob/5f616d5d557386d2be669b47b8bc846f589a7ea2/std/haxe/Int128.hx#L67C2-L73C3

Could it be that the overflow checks are missing on the toInt method?

With kind regards, mikaib

mikaib avatar Aug 24 '24 17:08 mikaib

Just a quick question:

https://github.com/SomeGuyWhoLovesCoding/haxe-int128/blob/5f616d5d557386d2be669b47b8bc846f589a7ea2/std/haxe/Int128.hx#L67C2-L73C3

Could it be that the overflow checks are missing on the toInt method?

With kind regards, mikaib

The overflow checks are not missing. I just did Int64.toInt(x.low) just to write easier. Then, the low value can do the job instead of repeating the whole task with the int128 value.

SomeGuyWhoLovesCoding avatar Aug 24 '24 17:08 SomeGuyWhoLovesCoding

Successfully finished implementing the Int128 numeral literal suffix for haxe. Now it's done.

SomeGuyWhoLovesCoding avatar Aug 25 '24 03:08 SomeGuyWhoLovesCoding

I see why the issue happened in the first place now

SomeGuyWhoLovesCoding avatar Sep 02 '24 02:09 SomeGuyWhoLovesCoding

Okay so I should've left the increment and decrement functions alone as the tests want My bad

SomeGuyWhoLovesCoding avatar Sep 02 '24 02:09 SomeGuyWhoLovesCoding

The pain is finally over

SomeGuyWhoLovesCoding avatar Sep 02 '24 03:09 SomeGuyWhoLovesCoding

Now time to wait until the action is fully finished with the checks and this pr gets merged

SomeGuyWhoLovesCoding avatar Sep 02 '24 03:09 SomeGuyWhoLovesCoding

I gotta make an issue about that

SomeGuyWhoLovesCoding avatar Sep 02 '24 03:09 SomeGuyWhoLovesCoding

Now I'm just waiting for this pr to get merged

SomeGuyWhoLovesCoding avatar Sep 04 '24 14:09 SomeGuyWhoLovesCoding

balls

LeonGamerPS1 avatar Sep 04 '24 15:09 LeonGamerPS1

balls

Ok

SomeGuyWhoLovesCoding avatar Sep 04 '24 15:09 SomeGuyWhoLovesCoding

Ignore the commits adter the hrr 717 mention. It was an accident and I didn't mean to do so.

SomeGuyWhoLovesCoding avatar Sep 11 '24 14:09 SomeGuyWhoLovesCoding

100 commits. Oh boy. I wasted the 15 of them lol

SomeGuyWhoLovesCoding avatar Sep 12 '24 16:09 SomeGuyWhoLovesCoding

The toString() function runs very slow, so I'm rewriting it.

SomeGuyWhoLovesCoding avatar Nov 09 '24 20:11 SomeGuyWhoLovesCoding

This pr is now officially closed.

My haxe fork is staying.

SomeGuyWhoLovesCoding avatar Nov 09 '24 21:11 SomeGuyWhoLovesCoding