[dev] dwm bit fields conversion
In Xdefs.h, Bool is typedef'd as int (= at least 2 bytes, sometimes more, depending on the implementation), of which we set the last bit to 1 or 0.
In the Monitor and Client structures dwm uses, we can instead use char bit fields, storing up to 8 Bool values in 1 byte.
diff --git a/dwm.c b/dwm.c
index 314adf4..83af1f6 100644
--- a/dwm.c
+++ b/dwm.c
_AT_@ -91,7 +91,7 @@ struct Client {
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
int bw, oldbw;
unsigned int tags;
- Bool isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
+ unsigned char isfixed :1, isfloating :1, isurgent :1, neverfocus :1, oldstate :1, isfullscreen :1, :2;
Client *next;
Client *snext;
Monitor *mon;
_AT_@ -121,8 +121,7 @@ struct Monitor {
unsigned int seltags;
unsigned int sellt;
unsigned int tagset[2];
- Bool showbar;
- Bool topbar;
+ unsigned char showbar :1, topbar :1, :6;
Client *clients;
Client *sel;
Client *stack;
Received on Sun Jul 07 2013 - 16:49:15 CEST
This archive was generated by hypermail 2.3.0
: Sun Jul 07 2013 - 17:00:06 CEST