this post was submitted on 07 Jul 2025
1294 points (99.1% liked)

Microblog Memes

8441 readers
3394 users here now

A place to share screenshots of Microblog posts, whether from Mastodon, tumblr, ~~Twitter~~ X, KBin, Threads or elsewhere.

Created as an evolution of White People Twitter and other tweet-capture subreddits.

Rules:

  1. Please put at least one word relevant to the post in the post title.
  2. Be nice.
  3. No advertising, brand promotion or guerilla marketing.
  4. Posters are encouraged to link to the toot or tweet etc in the description of posts.

Related communities:

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 45 points 23 hours ago (8 children)

Well, no. They are not certainly using int, they might be using a more efficient data type.

This might be for legacy reasons or it might be intentional because it might actually matter a lot. If I make up an example, chat_participant_id is definitely stored with each message and probably also in some index, so you can search the messages. Multiply this over all chats on WhatsApp, even the ones with only two people in, and the difference between u8 and u16 might matter a lot.

But I understand how a TypeScript or Java dev could think that the difference between 1 and 4 bytes is negligible.

[–] [email protected] -5 points 21 hours ago (4 children)

They are not certainly using int

Probably why I said "almost certainly". And I stand by that. We're not talking about chat_participant_id, we're talking about GROUP_CHAT_LIMIT, probably a constant somewhere. And we're talking about a value that would require a 9-bit unsigned int to store it, at a minimum (and therefore at least a 16-bit integer in sizes that actually exist for types). Unless it's 8-bit and interprets a 0 as 256, which is highly unorthodox and would require bespoke coding basically all over instead of a basic num <= GROUP_CHAT_LIMIT.

[–] [email protected] 2 points 17 hours ago* (last edited 17 hours ago) (2 children)

And we're talking about a value that would require a 9-bit unsigned int to store it, at a minimum (and therefore at least a 16-bit integer in sizes that actually exist for types). Unless it's 8-bit and interprets a 0 as 256, which is highly unorthodox and would require bespoke coding basically all over instead of a basic num <= GROUP_CHAT_LIMIT.

I think you're just very confused friend, or misunderstanding how binary counting works, because why in the 9 hells would they be using 9 bits (512 possible values) to store 8 bits (256 possible members) of data?

I think you're confusing indexing (0-255) with counting (0-256), and mistakenly including a negation state (counting 0, which would be a null state for the variable) in your conception of the process. Because yes, index 255 is in fact count 256 and 0 would actually be 1. Index = count -1

[–] [email protected] 1 points 15 hours ago (1 children)

I'm imagining something like this:

def add_member(group, user):
    if (len(group.members) <= GROUP_CHAT_LIMIT):
        ...

If GROUP_CHAT_LIMIT is 8 bits, this does not work.

[–] [email protected] 2 points 15 hours ago

So add a +1 like you would for any index to count comparison?

I guess I'm failing to see how this doesn't work as long as you properly handle the comparison logic. Maybe you can explain how this doesn't work...

load more comments (1 replies)
load more comments (4 replies)