thedevs_c | Unsorted

Telegram-канал thedevs_c - C / C++

-

Rules: @rulesforthedevs Other @thedevs groups: https://thedevs.network

Subscribe to a channel

C / C++

Then click the commit to the left of the line

Читать полностью…

C / C++

https://github.com/unicode-org/icu/pull/3035

Читать полностью…

C / C++

Ai says to do

git log -S "int32_t MAX_NESTED_LEVELS=0x03ff;" --reverse

To find it

Читать полностью…

C / C++

The limits are fixed, the encoding/storage/packing is flexible

Читать полностью…

C / C++

I sure will in the future 😄

Читать полностью…

C / C++

Roman went off to reconsider all his base-10 numeric limits

Читать полностью…

C / C++

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

Читать полностью…

C / C++

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

Читать полностью…

C / C++

And you can have:
packed struct(u16) {
nestingLevel: u10,
reserved: u6,
}

Читать полностью…

C / C++

If the limit is something round in decimal, you would obviously write it in decimal

Читать полностью…

C / C++

It might as well be one where you make full utilization of the bits the value within that limit takes up

Читать полностью…

C / C++

It could also mean that they just want to reserve some bits for future use

Читать полностью…

C / C++

maybe it is a bitmask somewhere
but that somewhere is basically undefined.

Читать полностью…

C / C++

yeah, that I do get, that makes sense

Читать полностью…

C / C++

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 🙂

Читать полностью…

C / C++

Click "Blame" on github, since we already have the github link to the exact file

Читать полностью…

C / C++

That's the worst way to find it

Читать полностью…

C / C++

Maybe the commit that introduced it has an explanation?

Читать полностью…

C / C++

One should not pass on future metadata slots

Читать полностью…

C / C++

still a problem, the limits are just much higher 😄

Читать полностью…

C / C++

(not a problem in Go ofc, since Go just allocates)

Читать полностью…

C / C++

Come to think of it there might be another good reason to limit this value

Читать полностью…

C / C++

But really you can view a normal u16 as the same thing

Читать полностью…

C / C++

This is much simpler to think about in Zig ofc, where you just have u10

Читать полностью…

C / C++

hmmm, now that I thought about it from that perspective it does make more sense now

Читать полностью…

C / C++

Sometimes you just need to pick a limit

Читать полностью…

C / C++

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

Читать полностью…

C / C++

but that limit constant declaration in hex makes zero sense to me 🙂 but alright, I don't think this discussion is worth continuing 😄

Читать полностью…

C / C++

Maybe not in this repo, but elsewhere

Читать полностью…

C / C++

0 -> 0000
3 -> 0011
f -> 1111
f -> 1111

Читать полностью…
Subscribe to a channel