...
Code Block | ||
---|---|---|
| ||
char *ptr; unsigned int flag; /* ... */ unsigned int number = (unsigned int)ptr; number = (number & 0x7fffff) | (flag << 23); ptr = (char *)number; |
A similar scheme was used in early versions of Emacs, limiting its portability and preventing the ability to edit files larger than 8MB.
...
Code Block | ||
---|---|---|
| ||
struct ptrflag {
char *pointer;
unsigned int flag :9;
} ptrflag;
char *ptr;
unsigned int flag;
/* ... */
ptrflag.pointer = ptr;
ptrflag.flag = flag;
|
...