Files
2026-08-28 09:25:48 -04:00

1.5 KiB
Raw Permalink Blame History

title, type, source, source_url, author, handle, post_id, date, archived, draft, tags, description, in_reply_to
title type source source_url author handle post_id date archived draft tags description in_reply_to
Unsigned Integer divide by zero, x/0=?, what answer is preferred {x (nop), 0, or 0xffffffff (max integer)}? archive twitter https://x.com/NOTimothyLottes/status/2066678716206289353 NOTimothyLottes NOTimothyLottes 2066678716206289353 2026-06-16 2026-08-28 false
archive
twitter
NOTimothyLottes
Unsigned Integer divide by zero, x/0=?, what answer is preferred {x (nop), 0, or 0xffffffff (max integer)}?

Source

Thread

1/ @NOTimothyLottes ^2066678716206289353

Unsigned Integer divide by zero, x/0=?, what answer is preferred {x (nop), 0, or 0xffffffff (max integer)}?

2/ @NOTimothyLottes ^2066690080098451916

So I went with a NOP, and things get more interesting with signed divide, because on x86 there are 2 cases that will interrupt. So my div wrappers fix both cases to NOPs. Logically it works more like abs and neg in cases of overflow. Details in photo.

3/ @NOTimothyLottes ^2066690873706836163

I do agree it’s too bad x86 forces the interrupt, and I want zero chance of interrupt crash. In that regard same as others. However, interesting that I ended up in the opposite solution space as everyone else ;)