Post AxZFD55NdhyTwN6O5g by harold@mastodon.gamedev.place
 (DIR) More posts by harold@mastodon.gamedev.place
 (DIR) Post #AxZDnLRc61PFBzfKU4 by harold@mastodon.gamedev.place
       2025-08-26T16:20:34Z
       
       0 likes, 0 repeats
       
       Some languages have 1 "kind" of fized-sized integer (let's forget about 0) like Java (and let's forget about "ackchyually char is "), mostly "well you have signed integers, you can use them as unsigned but it's awkward across interface boundaries", some have 2 (signed/unsigned), what about 3: signed/unsigned/bitvectorAnd no I don't mean "like C++ because it has std::bitset<N>", I mean a proper integer type (add, multiply, other integers implicitly convert to it) with no signedness
       
 (DIR) Post #AxZDnMZnt3YGhgVNtA by wolf480pl@mstdn.io
       2025-08-26T16:26:09Z
       
       0 likes, 0 repeats
       
       @harold so no carry?
       
 (DIR) Post #AxZDvFMEbuFkdCux84 by wolf480pl@mstdn.io
       2025-08-26T16:27:37Z
       
       0 likes, 0 repeats
       
       @harold like5 + 3 = 7 ?
       
 (DIR) Post #AxZE0wS7oNi9jhO8oq by wolf480pl@mstdn.io
       2025-08-26T16:28:39Z
       
       0 likes, 0 repeats
       
       @harold wait no that's wrong, 5+3=6
       
 (DIR) Post #AxZEqdQVnLm9moHblo by harold@mastodon.gamedev.place
       2025-08-26T16:37:58Z
       
       0 likes, 0 repeats
       
       @wolf480pl well I didn't mean "add = xor" (and presumably mul=clmul?), that's fun too but I don't think common enough to promote to a built-in type this way, more something along the lines of "doesn't commit to having a signed or unsigned interpretation" - useable when signedness is irrelevant (eg can be added or multiplied the same way other integers do, but doesn't implicitly sign-extend or zero-extend, has no default order, cannot be divided, that sort of thing but the details are negotiable)
       
 (DIR) Post #AxZF3191RE7Moy0U8O by wolf480pl@mstdn.io
       2025-08-26T16:40:14Z
       
       0 likes, 0 repeats
       
       @harold oh, so "it's either signed or unsigned but it's undefined which of the two" ?
       
 (DIR) Post #AxZFAMYyCeE7HCe8FU by wolf480pl@mstdn.io
       2025-08-26T16:41:34Z
       
       0 likes, 0 repeats
       
       @harold would you use it for loop indices and such?
       
 (DIR) Post #AxZFD55NdhyTwN6O5g by harold@mastodon.gamedev.place
       2025-08-26T16:42:02Z
       
       0 likes, 0 repeats
       
       @wolf480pl I'd even say, it's neither. Imagine if signed and unsigned integers derived from a common class that has the shared behavior of signed and unsigned integers but not anything that's different
       
 (DIR) Post #AxZFjzyXf0ENeCbFIG by wolf480pl@mstdn.io
       2025-08-26T16:48:00Z
       
       0 likes, 0 repeats
       
       @harold so, you can't cast to a wider type?Or you get undefined bits on top?Oooh, like assigning to AL and then reading AX?
       
 (DIR) Post #AxZHz86Fw5ot64YCuG by harold@mastodon.gamedev.place
       2025-08-26T17:13:07Z
       
       0 likes, 0 repeats
       
       @wolf480pl perhaps there could be explicit sign and zero extensions, if that's what we want, but the type itself wouldn't make the choice between them
       
 (DIR) Post #AxZI91NplL79A6UOuW by wolf480pl@mstdn.io
       2025-08-26T17:14:54Z
       
       0 likes, 0 repeats
       
       @harold are there any interesting things the compiler can do with these types that it wouldn't be able to do otherwise?Or is this just a way to express API more precisely?
       
 (DIR) Post #AxZJ9NpqO4d4kVKMIy by harold@mastodon.gamedev.place
       2025-08-26T17:26:09Z
       
       0 likes, 0 repeats
       
       @wolf480pl every fixed-size integer is already a bitvector from a compiler's perspective so it wouldn't help in that senseBut yes, what are the consequences. Various functions could be written "signedness-generically" if that's what we wanted (but do we?) which is essentially the status quo in "1 kind of integer"-languages like Java but you have to pretend the types are signed. Perhaps it provides an answer to "what do you get when you add s32 to u32" (could widen to s64, or go no-signedness)