ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtutil.h
(Generate patch)

Comparing rxvt-unicode/src/rxvtutil.h (file contents):
Revision 1.42 by root, Mon Jan 3 03:05:47 2011 UTC vs.
Revision 1.43 by root, Mon Jan 3 18:42:58 2011 UTC

42# define NOTHROW throw() 42# define NOTHROW throw()
43# define THROW(x) throw x 43# define THROW(x) throw x
44#endif 44#endif
45 45
46namespace byteorder { 46namespace byteorder {
47 static uint32_t e () 47 static unsigned char e ()
48 { 48 {
49 char c [4] = { 0x11, 0x22, 0x33, 0x44 }; 49 const uint32_t u = 0x11223344;
50 return *(uint32_t *)c; 50 return *(unsigned char *)u;
51 } 51 }
52 52
53 static bool big_endian () { return e () == 0x11223344; }; 53 static bool big_endian () { return e () == 0x11; };
54 static bool network () { return big_endian (); }; 54 static bool network () { return big_endian (); };
55 static bool little_endian () { return e () == 0x44332211; }; 55 static bool little_endian () { return e () == 0x44; };
56 static bool vax () { return little_endian (); }; 56 static bool vax () { return little_endian (); };
57}; 57};
58 58
59// various utility functions 59// various utility functions
60template<typename T, typename U> static inline T min (T a, U b) { return a < (T)b ? a : (T)b; } 60template<typename T, typename U> static inline T min (T a, U b) { return a < (T)b ? a : (T)b; }
61template<typename T, typename U> static inline void min_it (T &a, U b) { a = a < (T)b ? a : (T)b; } 61template<typename T, typename U> static inline void min_it (T &a, U b) { a = a < (T)b ? a : (T)b; }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines