#include <bitptr.h>
Public Member Functions | |
| bitptr_t () | |
| Default constructor. | |
| bitptr_t (PtrType *ptr) | |
| Pointer constructor. | |
| bitptr_t (uintptr_t mask) | |
| Bits constructor. | |
| bitptr_t (intptr_t mask) | |
| Bits constructor, only a wrapper for convenience. | |
| bitptr_t (PtrType *ptr, uintptr_t mask) | |
| Pointer and bits constructor. | |
| bitptr_t (PtrType *ptr, intptr_t mask) | |
| Pointer and bits constructor, wrapper for convenience only. | |
| bitptr_t (bitptr_t< PtrType > ptr, uintptr_t mask) | |
| IntPtr and new bits for int part. | |
| bitptr_t (bitptr_t< PtrType > ptr, intptr_t mask) | |
| IntPtr and new bits for int part, wrapper for convenience only. | |
| bitptr_t (PtrType *ptr, bitptr_t bits) | |
| IntPtr and new bits for int part. | |
| uintptr_t | getBits () const |
| Read the int bits only. | |
| uintptr_t | getBits (uintptr_t mask) const |
| Read some bits only from the int bits. | |
| intptr_t | getBits (intptr_t mask) const |
| Read some bits only from the int bits, wrapper for convenience only. | |
| PtrType * | getPtr () const |
| Read the pointer part. | |
| void | addBits (uintptr_t mask) |
| Add bits and don't touche the pointer part. | |
| void | addBits (intptr_t mask) |
| Add bits and don't touche the pointer part, for convenience only. | |
| void | delBits (uintptr_t mask) |
| Delete bits and don't touch the pointer part. | |
| void | delBits (intptr_t mask) |
| Delete bits and don't touch the pointer part, for convenience only. | |
| void | setPtr (PtrType *ptr) |
| Set the pointer part and keep the int part. | |
Private Attributes | |
| bitptr_u | value |
| value & ~3 is the pointer and value & 3 is the int part | |
bitptr_t protects operation on the 2 lower bits of a pointer. These bits may contain data. Valid operation is done only on those 2 bits. Name IntPtr chosen because it is a hybrid type both an int and a pointer. Name in lower case because it is a wrapper around a pointer/int basic scalar type.
|
|||||||||
|
Default constructor.
|
|
||||||||||
|
Pointer constructor.
|
|
||||||||||
|
Bits constructor.
|
|
||||||||||
|
Bits constructor, only a wrapper for convenience.
|
|
||||||||||||||||
|
Pointer and bits constructor.
|
|
||||||||||||||||
|
Pointer and bits constructor, wrapper for convenience only.
|
|
||||||||||||||||
|
IntPtr and new bits for int part. Takes pointer from ptr and bits from mask
|
|
||||||||||||||||
|
IntPtr and new bits for int part, wrapper for convenience only. Takes pointer from ptr and bits from mask
|
|
||||||||||||||||
|
IntPtr and new bits for int part. Takes pointer from ptr and bits from mask
|
|
||||||||||
|
Add bits and don't touche the pointer part, for convenience only.
|
|
||||||||||
|
Add bits and don't touche the pointer part.
|
|
||||||||||
|
Delete bits and don't touch the pointer part, for convenience only.
|
|
||||||||||
|
Delete bits and don't touch the pointer part.
|
|
||||||||||
|
Read some bits only from the int bits, wrapper for convenience only.
|
|
||||||||||
|
Read some bits only from the int bits.
|
|
|||||||||
|
Read the int bits only.
|
|
|||||||||
|
Read the pointer part.
|
|
||||||||||
|
Set the pointer part and keep the int part.
|
|
|||||
|
value & ~3 is the pointer and value & 3 is the int part
|
1.4.2