-
Rules: @rulesforthedevs Other @thedevs groups: https://thedevs.network
Ai says to do
git log -S "int32_t MAX_NESTED_LEVELS=0x03ff;" --reverse
The limits are fixed, the encoding/storage/packing is flexible
Читать полностью…
Roman went off to reconsider all his base-10 numeric limits
Читать полностью…
If this relates to a recursive algorithm somewhere that actually has to recurse once per nesting level, it might be good to not permit 65535 stack frames
Читать полностью…
It just happens that there seems to be no use of extra fields within this value, so there's no need to shift or mask, since the 10 nestinglevel bits are the only bits in use
Читать полностью…
And you can have:
packed struct(u16) {
nestingLevel: u10,
reserved: u6,
}
If the limit is something round in decimal, you would obviously write it in decimal
Читать полностью…
It might as well be one where you make full utilization of the bits the value within that limit takes up
Читать полностью…
It could also mean that they just want to reserve some bits for future use
Читать полностью…
maybe it is a bitmask somewhere
but that somewhere is basically undefined.
it's a simple depth limit.
Nobody explains why it's 1023 anywhere.
There's no bitwise operations involving it.
There's no place in the code that packs it into 10 bits
this is not a mask 🙂
Click "Blame" on github, since we already have the github link to the exact file
Читать полностью…
Maybe the commit that introduced it has an explanation?
Читать полностью…
Come to think of it there might be another good reason to limit this value
Читать полностью…
But really you can view a normal u16 as the same thing
Читать полностью…
This is much simpler to think about in Zig ofc, where you just have u10
Читать полностью…
hmmm, now that I thought about it from that perspective it does make more sense now
Читать полностью…
I mean, I get the part that it's 1023 so it fits exactly into 10 bits.
But there's zero justification and reasoning for it to fit in 10 bits, because it's always put in int16
but that limit constant declaration in hex makes zero sense to me 🙂 but alright, I don't think this discussion is worth continuing 😄
Читать полностью…