▲ | newpavlov 3 days ago | |||||||||||||||||||||||||
Tangential note: I sometimes wish that signed integers were symmetrical. i8 would represent the range of [-127 to 127] with 0xFF representing NaN. Any operation which can not be computed (division by zero, overflows, operation with another NaN, etc.) would result in NaN. For further symmetry we could do the same for signed integers as well. Yes, it's possible to encode such types manually, but it will not be efficient since CPUs do not natively support such operations. | ||||||||||||||||||||||||||
▲ | lock1 3 days ago | parent | next [-] | |||||||||||||||||||||||||
Wouldn't this make CPU flags useless? I think it would complicate branch instructions too, as most modern CPUs tend to use integer operations for branching. Also, this in-band signaling probably would invite something similar to `null` mess in type systems. I can't wait to tell CPU to JMP NaN. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
▲ | zokier 3 days ago | parent | prev [-] | |||||||||||||||||||||||||
That sounds surprisingly reasonable idea for signeds. Less so for unsigneds though. Has there been any architecture doing anything like that? | ||||||||||||||||||||||||||
|