This one has just offered up my thoughts! We remember the previous

post which manufactured a similar expression has been of these

guys https://solothurnclassics.ch/review-dragon-sinker-vita/. I’m

so grateful, you have made my day time! Proceed in typically the same pace in addition to style, thank a

person. ]]>

x = ~y >> (32 – n)

I am running into a theoretical misunderstanding when x >= 32. For simplification, if n = 5 and integers are 8-bit, suppose

int x = 44 // 000101100

Then

int y = x >> n // 00000001

//now we convert to ~y = 11111110 and shift to the right (8-3) = 5 bits for 11111111 = -1

Interestingly, the code implementation and proper substitutions yield this exact result on console (regardless of bit-length since they’re all going to be filled in this case.)

Now if I was not sign-extending, the answer would be 00011111 or 31, which is exactly 2^n – 1. Maybe I’m missing something? Are there instances where shifting bits implements sign-extension and… no sign extension? Or is there something missing in the code?

SOLVED AS I TYPED: As I wrote this out, I suddenly understood it. But I figured it might be important for people who read this and fall into the trap I did. y is unsigned. Meaning logical shifts only (i.e. no sign-extending since sign is irrelevant, thus my theoretical solution). x is signed and in the context of gcc implements arithmetic shifts. Yikes, me. The two shifts here are of two different hierarchies. Okay, great. Solved. Hope that helped you, future me.

]]> It is always such a joy to read articles created by real professionals, like https://septembercalendar2018.com/essay-topics-for-nutrition-classes/. I am fed up with that no-name, ghostwritten articles.

That is why it was so nice to have a look at a compelling piece.

I see the author has floor knowledge in the topic as well as some

practical experience. This sort of information is always more valuable than copypasted blog articles

ideas.

typedef struct scr_t

{

union {

u16 data;

struct {

u16 tile : 10;

u16 hflip : 1;

u16 vflip : 1;

u16 pal : 4;

};

};

} scr_t;

is it possible to use just

typedef union

{

u16 data;

struct

{

u16 tile : 10;

u16 hflip : 1;

u16 vflip : 1;

u16 pal : 4;

};

}scr_t;