Skip Navigation
How to write Hello World
  • #include <stdio.h>
    
    int main() {
    
    Long long x = 0x7165498511230;
    
    while (x) putchar(32 + ((0xC894A7875116601 >> ((x >>= 4) & 15) * 7) & 0x7F));
    
    return 0;
    }
    

    Might be wrong on a few things here as I haven't done C++ in a while, but my understanding is this. I'm sure you can guess that this is just a very cheekily written while loop to print the characters of "Hello, World!" but how does it work? So first off, all ASCII characters have an integer value. That 32 there is the value for the space character. So depending on what ((0xC894A7875116601 >> ((x >>= 4) & 15) * 7) & 0x7F)) evaluates down into you'll get different characters. The value for "H" for example is 72 so that first iteration we know that term somehow evaluated to the number 40 as 72 - 32 = 40.

    So how do we get there? That big number, 0xC894A7875116601 is getting shifted right some number of bits. Let's start evaluating the parenthesis. (X >>= 4) means set x to be itself after bit shifting it right by 4 bits then whatever that number is we bitwise AND it with 15 or 1111 in binary. This essentially just means each iteration we discard the rightmost digit of 0x7165498511230, then pull out the new right most digit. So the first iteration the ((x >>= 4) & 15) term will evaluate to 3, then 2, then 1, then 1, etc until we run out of digits and the loop ends since effectively we're just looking for x to be 0.

    Next we take that number and multiply it by 7. Simple enough, now for that first iteration we have 21. So we shift that 0xC894A7875116601 right 21 bits, then bitwise AND that against 0x7F or 0111 1111 in binary. Just like the last time this means we're just pulling out the last 7 bits of whatever that ends up being. Meaning our final value for that expression is gonna be some number between 0 and 127 that is finally added to 32 to tell us our character to print.

    There are only 10 unique characters in "Hello, World!" So they just assigned each one a digit 0-9, making 0x7165498511230 essentially "0xdlroW ,olleH!" The first assignment happens before the first read, and the loop has a final iteration with x = 0 before it terminates. Which is how the "!" gets from one end to the other. So they took the decimal values for all those ASCII characters, subtracted 32 then smushed them all together in 7 bit chunks to make 0xC894A7875116601 the space is kinda hidden in the encoding since it was assigned 9 putting it right at the end which with the expression being 32 + stuff makes it 0 and there's an infinitely assumed parade of 0s to the left of the C.

  • the fastest transition in the west
  • Most likely just awkward rounding when the screenshot was taken. A lot of the time those post age indicator tags just count the number of hours between it and you then each multiple of 24 is a day without caring about when the actual date changes. So the first could easily have been at like 7pm one day and the second like 11am the next day and they'd both get abbreviated at 6 days ago if you were looking at it at like 4pm when you haven't quite hit the next multiple of 24 hours.

  • Have you got any weird questions for the opposite gender?
  • That's basically been my experience as a "guy" too. I've given tons of compliments to random passing women and never once had it received poorly. The problem a lot of guys have is that their idea of a compliment is telling a woman she's got nice tits as a pretense to engage in conversation. Usually with the end goal of getting a date.

  • egg_irl [Transfem meme]
  • I wish I could have learned about nonbinary identity much earlier. Like back when I was having a crisis about my gender in high school I only knew the full binary MtF and FtM existed. But whenever I thought about it being a girl felt just as wrong as being a boy to me. Just for different reasons. No matter how hard I tried I couldn't reconcile not wanting to be a boy, periodically wishing I had been born a girl, but not actually wanting to be a girl.

    Wasn't until about 12 years later at like 26 when I met my now wife and she told me all that sounded like nonbinary and I suddenly had things to Google. I wish I could have had a chance to actually transition before fully growing into being 6'2" and built like a fridge in a fursuit. But like now I'm 33, I had other medical issues that I didn't want to try piling a potential transition on top of, and I'm not even sure what realistic transition goals I could even have let alone have a chance of attaining.

  • The Social Security Fix Nobody Wants to Talk About | A small tax increase would make the essential national retirement program secure for decades, our columnist says, but lawmakers would have to act
  • Wouldn't it be more like a 1.25% increase for most people since that part of the payroll tax is split half and half between employers and employees? I might be reading it wrong but sounds like they're proposing raising the entire 12.8% or whatever it is payroll tax that much. So it'd go from like 6.4% to like 7.7%.

  • Israel Threatens 'Severe Consequences' for Nations Who Recognize Palestine
  • Technically the US is sending lots of weapons to Russia. Ukraine are even being real Bros about it and trying to deliver the munitions first cuz Russia keeps misplacing their stuff. Not their fault Russia is doing a very poor job of accepting their deliveries.

  • TIL that some people do not have an inner voice and think in different nonverbal ways.
  • For me it's even weirder than that. Those pictures exist in my mind and I can "feel" them there but the conscious part of me that's supposed to see them can't see shit. I can describe to you the things that are in them or even draw them out as they exist in my mind, but I can't see them. The part of me that's giving directions? It can "see" the map of the building and my position in it just fine like it's staring straight at a live minimap, but the conscious part of me that should be able to visualize that stuff? Nothing. I close my eyes and try to visualize that dog and I see nothing but black. But I can feel the presence of the image that the part of me that does the mental conjuring of images is making.

    It's like turning the monitor off on a computer. Everything is still running even though you can't see it.

  • TIL that some people do not have an inner voice and think in different nonverbal ways.
  • I have ADHD too but in my case I don't actually "hear" any of the thoughts. But they exist similar to how you describe. At any given time I can feel multiple different thoughts kind of floating around. When music gets stuck in my head I don't so much hear it in there as I feel the presence of a song. So I have to talk out loud in order to keep from losing the thread of what I was thinking about.

  • TIL that some people do not have an inner voice and think in different nonverbal ways.
  • It's hard to describe for me. Cuz I don't actually "see" anything I try to imagine. If I close my eyes and try to visualize say an image of a desk at a window all I see is darkness. The image exists, I can I guess I'd say "feel" it there and i could even draw it. But I can't "see" it. Like the part of me that's making the picture is drawing it on a live stream but the part of me that should be seeing the stream has the monitor off.

    Same with the whole internal monologue thing. I don't "hear" the words in my head or "see" them written out in my imagination but I kinda just "feel" them there. It poses a problem when my mind really gets going because there will be often like half a dozen different distinct thoughts I can feel in there. So I end up having to talk to myself out loud in order to keep from losing whatever thread I'm trying to follow.

  • lemmy stop silencing SA survivors rule
  • Okay very basically this whole thing started with a hypothetical posed to a bunch of women about which they would rather run into while alone in the woods; A random man, or a bear. A lot of women chose the bear. Reasons varied from "The worst the bear will do is kill me," to "At least I know the bear wants to kill me," with a general theme seeming to be that whatever tangible threat the bear posed was preferable to the uncertainty of wondering whether or not a random man would assault them.

    The poster's stated goal with the hypothetical was to get men to think about why the women were choosing the bear. Instead a lot of guys took it as a personal attack, like they were being punished for the actions of other men. Many started attacking the question, insisting that bears are way more dangerous than virtually any man. This led to a lot of dismissive responses of the criticism like "This is why women choose the bear," or talking about women's safety being more important than men's feelings.

    I'm simplifying a lot but that's the basic gist of it.

  • All my real Americans from US State stand up!
  • The ones that get me are the ones that talk about voting 3rd party. A lot of them seem to understand that the 3rd party is not going to win and that their best case scenario is... I guess "Next time they'll listen to us and we'll get a real leftist?" So... Your solution to the genocide is wait 4 years to get someone who will directly end it? Bestie, I don't think Gaza will be around in 4 years. Even if you discount Trump's stated desire to be a dictator and Project 2025.

    Or, what happens by the way if Biden wins in spite of them voting 3rd party? Surely it doesn't mean that they've directly proven to the Democrats that they literally don't need that voting bloc?

  • girls rule
  • I think you did great tbh! 10/10 teenage me would absolutely 100% never had any idea you were into them. But I also didn't figure out I was asexual until my mid twenties so idk if I can really count as a data point lol.

  • Business Cat
  • Sorry but I'm not taking any kind of advice from an Orange Boi, financial or otherwise unless I've got some way to know if they were in possession of the braincell when giving the advice.

  • Can’t stand it when they do that
  • Between my ADHD and the amount of different places we go for groceries I can never remember well enough where anything is to get mad about them changing it. My wife though has finally gotten to the point where the music they play on the radio in the grocery stores is actually getting good which was her sign she's getting old.

  • Can’t stand it when they do that
  • My oldest son is autistic and has taste and texture aversions that are powerful enough that he will sooner starve himself than eat something that isn't right. So when we find something he will just eat? You better believe we are buying as much as our fixed budget can support. There's a mighty rage to be had from us when something he does eat gets changed or discontinued.

  • InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)EM
    EmptySlime @lemmy.blahaj.zone
    Posts 0
    Comments 131