diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/BString.h | 2 | ||||
-rw-r--r-- | include/Handle.h | 6 | ||||
-rw-r--r-- | include/generic.h | 13 |
3 files changed, 14 insertions, 7 deletions
diff --git a/include/BString.h b/include/BString.h index a0aa10b..a57f203 100644 --- a/include/BString.h +++ b/include/BString.h @@ -8,7 +8,7 @@ #include <generic.h> struct ugly_string { - char * p; + const char * p; }; class String : public Base { diff --git a/include/Handle.h b/include/Handle.h index 25b22a7..1a3973d 100644 --- a/include/Handle.h +++ b/include/Handle.h @@ -15,6 +15,12 @@ class Handle : public Base { virtual ~Handle(); virtual ssize_t read(void *buf, size_t count) throw (GeneralException); virtual ssize_t write(const void *buf, size_t count) throw (GeneralException); + Uint8 readU8(); + Uint16 readU16(); + Uint32 readU32(); + void writeU8(Uint8); + void writeU16(Uint16); + void writeU32(Uint32); bool IsClosed(void) const; bool IsNonBlock(void) const; void SetNonBlock(void); diff --git a/include/generic.h b/include/generic.h index 964501f..f20eeb7 100644 --- a/include/generic.h +++ b/include/generic.h @@ -74,10 +74,10 @@ typedef unsigned _int64 uint64; #ifndef PACKED #if defined __linux__ || defined __CYGWIN32__ #define PACKED __attribute__((packed)) -#else +#else // PACKED #define PACKED #endif -#endif +#endif // !PACKED extern char verbosity; char ** split(char * s, char t); @@ -98,7 +98,8 @@ inline T MIN(T a, T b) { } #endif -#else +#else // cplusplus + #ifndef MAX #define MAX(__a,__b) ((__a)<(__b)?(__b):(__a)) #endif @@ -107,11 +108,11 @@ inline T MIN(T a, T b) { #define MIN(__a,__b) ((__a)>(__b)?(__b):(__a)) #endif -#endif +#endif // !cplusplus #define BITCOUNT(x) (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255) -#define BX_(x) ((x) - (((x)>>1)&0x77777777) \ - - (((x)>>2)&0x33333333) \ +#define BX_(x) ((x) - (((x)>>1)&0x77777777) \ + - (((x)>>2)&0x33333333) \ - (((x)>>3)&0x11111111)) #define ISPOT(x) (((x)&(x-1))==0?1:0) |