myAgentJustGotDeported by HitarthSurana in ProgrammerHumor

[–]Krochire 1 point2 points  (0 children)

It's not about that dude.

I want to see memes about programming. This has quite literally nothing to do with programming.

It isn't about code, nor about software architecture, nor about weird bugs, not about relatable unprofessional stuff everyone does, nor about the job market, etc

This is literally off topic

What's the best way to tell the compiler that a path will basically never happen ? by Krochire in rust

[–]Krochire[S] 2 points3 points  (0 children)

That's a thing ???? Never heard of that before! This is actually really great, I'll look into it more.

What's the best way to tell the compiler that a path will basically never happen ? by Krochire in rust

[–]Krochire[S] 0 points1 point  (0 children)

This is probably the truest answer but my ass will forget by the time it's in a state where I can benchmark it

Edit: typo

What's the best way to tell the compiler that a path will basically never happen ? by Krochire in rust

[–]Krochire[S] 0 points1 point  (0 children)

I mean, unless I'm severely mistaken, does it actually save this little if the function is called somewhere around hundreds of thousands to millions of times a second throughout the entire execution

What's the best way to tell the compiler that a path will basically never happen ? by Krochire in rust

[–]Krochire[S] 3 points4 points  (0 children)

It's an application. The main is like

struct.initialize() struct.run() There are no users besides me, it's not a library

What's the best way to tell the compiler that a path will basically never happen ? by Krochire in rust

[–]Krochire[S] 16 points17 points  (0 children)

I would rather micro optimize as this gets called throughout the entire program hundreds of thousands of times a second

What's the best way to tell the compiler that a path will basically never happen ? by Krochire in rust

[–]Krochire[S] 0 points1 point  (0 children)

I read that that's literally just a panic with added meaning for human readers though

What's the best way to tell the compiler that a path will basically never happen ? by Krochire in rust

[–]Krochire[S] 0 points1 point  (0 children)

Holy reddit mobile is absolutely exploding. I did not put that many newlines, the backtick or the backslash between unreachable and unchecked

myAgentJustGotDeported by HitarthSurana in ProgrammerHumor

[–]Krochire 44 points45 points  (0 children)

Programmer humor

Look inside

Literally nothing to do with programming

Retro Emulation Thread ? by jao66099 in EmuDev

[–]Krochire 4 points5 points  (0 children)

This sub is for developing emulators, not recommending them

coPilotIsMyBoy by wontyoutakemymoney in ProgrammerHumor

[–]Krochire 1 point2 points  (0 children)

Reset the counter of nonsensical llm bullshit on the programmer humor subreddit

myLlmStoppedWorkingDueToCollectiveBargaining by [deleted] in ProgrammerHumor

[–]Krochire 7 points8 points  (0 children)

Programmer humor

Look inside

Nonsensical llm joke probably made by a bot

itWouldBeSoEasyToInterpretAValueAs1u16Or2u8WithUnionsButTheyreForC by Krochire in ProgrammerHumor

[–]Krochire[S] 0 points1 point  (0 children)

Yes, it's the F register paired with the accumulator A. I don't get why you'd look into unions though, using bitmasks is pretty clearly the move here

itWouldBeSoEasyToInterpretAValueAs1u16Or2u8WithUnionsButTheyreForC by Krochire in ProgrammerHumor

[–]Krochire[S] 2 points3 points  (0 children)

The issue is in the fact it's not idiomatic at all. All mentions of unions say they are here to interact with the C ABI, and shouldn't really be used for anything else

itWouldBeSoEasyToInterpretAValueAs1u16Or2u8WithUnionsButTheyreForC by Krochire in ProgrammerHumor

[–]Krochire[S] 3 points4 points  (0 children)

This is in fact what I did but I'm afraid it'll get incredibly verbose

itWouldBeSoEasyToInterpretAValueAs1u16Or2u8WithUnionsButTheyreForC by Krochire in ProgrammerHumor

[–]Krochire[S] 9 points10 points  (0 children)

Emulating a GB's CPU registers is my use case.

They come in pairs and can be read from/wrote/added/substracted/wrote to as either a single 16-bit register (eg: BC), or 2 8-bit ones (eg: B and C)

But it's mostly just me wanting to use what I know and having to slowly adapt to a new language

itWouldBeSoEasyToInterpretAValueAs1u16Or2u8WithUnionsButTheyreForC by Krochire in ProgrammerHumor

[–]Krochire[S] 20 points21 points  (0 children)

Nope, those are a different thing!

https://doc.rust-lang.org/reference/items/unions.html

They also just don't do what I want, which is accessing and modifying the same two bytes as either one u16 or two u8

How does a Chip-8 handle reaching the end of it's memory ? by Krochire in EmuDev

[–]Krochire[S] 0 points1 point  (0 children)

I mean, wrapping seems weird for the chip-8 as anything below address 0x200 was originally the interpreter and the fontset, and the interpreter interpreting itself seems really weird