MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/u8zz3f/just_doing_some_bit_operations_for_an_emulator/
r/badcode • u/Sherlock-Holmie • Apr 21 '22
7 comments sorted by
18
You do that, and one day you discover bitfields and your live changes forever
11 u/FloweyTheFlower420 sadistic Apr 22 '22 but then you realize that bit field layout is technically implementation defined 3 u/X71nc710n May 02 '22 Which is why you choose an implementation with packed attribute that is well defined like the gnu c implementation 1 u/[deleted] May 29 '22 Coding for a particular compiler implementation is usually to be avoided. Coding for particular architectures is fine in certain circumstances (various device drivers, embedded code, etc.)(In general). 1 u/frayien Apr 26 '22 :(
11
but then you realize that bit field layout is technically implementation defined
3 u/X71nc710n May 02 '22 Which is why you choose an implementation with packed attribute that is well defined like the gnu c implementation 1 u/[deleted] May 29 '22 Coding for a particular compiler implementation is usually to be avoided. Coding for particular architectures is fine in certain circumstances (various device drivers, embedded code, etc.)(In general). 1 u/frayien Apr 26 '22 :(
3
Which is why you choose an implementation with packed attribute that is well defined like the gnu c implementation
1 u/[deleted] May 29 '22 Coding for a particular compiler implementation is usually to be avoided. Coding for particular architectures is fine in certain circumstances (various device drivers, embedded code, etc.)(In general).
1
Coding for a particular compiler implementation is usually to be avoided. Coding for particular architectures is fine in certain circumstances (various device drivers, embedded code, etc.)
(In general).
:(
4
Image Transcription: Code
*op=(instruction>>26)&0b111111; *r1=(instruction>>21)&0b11111; *r2=(instruction>>16)&0b11111; *r3=(instruction>>11)&0b11111; *funct=instruction&0b111111; *offset=instruction&0b1111111111111111; *jsec=instruction&0b11111111111111111111111111;
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
2
Why?
18
u/frayien Apr 21 '22
You do that, and one day you discover bitfields and your live changes forever
4
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Apr 22 '22
Image Transcription: Code
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
2
u/Furry_69 Apr 22 '22
Why?