cm0002@lemmy.world to Programmer Humor@programming.dev · 2 days agoTell me the truth ...piefed.jeena.netimagemessage-square135fedilinkarrow-up11.14Karrow-down116
arrow-up11.12Karrow-down1imageTell me the truth ...piefed.jeena.netcm0002@lemmy.world to Programmer Humor@programming.dev · 2 days agomessage-square135fedilink
minus-squarekiri@ani.sociallinkfedilinkarrow-up23arrow-down1·edit-22 days agoI have a solution with a bit fields. Now your bool is 1 byte : struct Flags { bool flag0 : 1; bool flag1 : 1; bool flag2 : 1; bool flag3 : 1; bool flag4 : 1; bool flag5 : 1; bool flag6 : 1; bool flag7 : 1; }; Or for example: struct Flags { bool flag0 : 1; bool flag1 : 1: int x_cord : 3; int y_cord : 3; };
minus-squarelapping6596@lemmy.worldlinkfedilinkarrow-up3·2 days agoI watched a YouTube video where a dev was optimizing unity code to match the size of data that is sent to the cpu using structs just like this.
I have a solution with a bit fields. Now your bool is 1 byte :
struct Flags { bool flag0 : 1; bool flag1 : 1; bool flag2 : 1; bool flag3 : 1; bool flag4 : 1; bool flag5 : 1; bool flag6 : 1; bool flag7 : 1; };
Or for example:
struct Flags { bool flag0 : 1; bool flag1 : 1: int x_cord : 3; int y_cord : 3; };
I watched a YouTube video where a dev was optimizing unity code to match the size of data that is sent to the cpu using structs just like this.