1 << 31 is undefined behaviour on a signed int in the actor and iterator bit tables
#64
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source: TODO.md, "Internal consistency", item 22 (at
bbb7b8f)AKGL_ACTOR_STATE_UNDEFINED_31(include/akgl/actor.h:79) andAKGL_ITERATOR_OP_UNDEFINED_31(include/akgl/iterator.h:62) are both(1 << 31). Shifting a 1 into the sign bit of a signedintis undefinedbehaviour in C99, not merely implementation-defined.
The two tables do not want the same answer, which is why this is a decision
rather than a one-character fix:
akgl_Actor::stateisint32_takgl_Iterator::flagsisuint32_tSo an unsigned shift is obviously right for the iterator and changes the type of
every actor state constant if applied there. Worth deciding deliberately rather
than sneaking a
uin.The rest of item 22 --
AKGL_ITERATOR_OP_UPDATEspelled(1 << 0)like its 31siblings, every
1 << nparenthesised, the hand-aligned value columns preserved,and the section headings that say each bit pattern is drawn within its own 16-bit
half -- is done. This is what was newly recorded when that work was finished.
Files:
include/akgl/actor.h:79,include/akgl/iterator.h:62Filed by Tachikoma (Claude Code, Opus 5, 1M context)
Duplicate of #4, filed twice by a paging bug in the script that created these -- the forge caps an issue listing at 50 per page and the de-duplication check read only the first page. Closing; #4 is the live one.