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.34 by root, Sun Dec 2 22:37:14 2007 UTC vs.
Revision 1.37 by root, Mon Jul 21 16:51:31 2008 UTC

13 13
14#define HAVE_GCC_BUILTINS (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ == 4)) 14#define HAVE_GCC_BUILTINS (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ == 4))
15 15
16#if __GNUC__ >= 4 16#if __GNUC__ >= 4
17# define rxvt_attribute(x) __attribute__(x) 17# define rxvt_attribute(x) __attribute__(x)
18# define expect(expr,value) __builtin_expect ((expr),(value))
18#else 19#else
19# define rxvt_attribute(x) 20# define rxvt_attribute(x)
21# define expect(expr,value) (expr)
20#endif 22#endif
23
24// put into ifs if you are very sure that the expression
25// is mostly true or mosty false. note that these return
26// booleans, not the expression.
27#define expect_false(expr) expect ((expr) != 0, 0)
28#define expect_true(expr) expect ((expr) != 0, 1)
21 29
22#define NORETURN rxvt_attribute ((noreturn)) 30#define NORETURN rxvt_attribute ((noreturn))
23#define UNUSED rxvt_attribute ((unused)) 31#define UNUSED rxvt_attribute ((unused))
24#define CONST rxvt_attribute ((const)) 32#define CONST rxvt_attribute ((const))
25 33
98 ((unsigned int)(val) - (unsigned int)(beg) <= (unsigned int)(end) - (unsigned int)(beg)) 106 ((unsigned int)(val) - (unsigned int)(beg) <= (unsigned int)(end) - (unsigned int)(beg))
99 107
100// in range excluding end 108// in range excluding end
101#define IN_RANGE_EXC(val,beg,end) \ 109#define IN_RANGE_EXC(val,beg,end) \
102 ((unsigned int)(val) - (unsigned int)(beg) < (unsigned int)(end) - (unsigned int)(beg)) 110 ((unsigned int)(val) - (unsigned int)(beg) < (unsigned int)(end) - (unsigned int)(beg))
111
112// for m >= -n, ensure remainder lies between 0..n-1
113#define MOD(m,n) (((m) + (n)) % (n))
103 114
104// makes dynamically allocated objects zero-initialised 115// makes dynamically allocated objects zero-initialised
105struct zero_initialized { 116struct zero_initialized {
106 void *operator new (size_t s); 117 void *operator new (size_t s);
107 void operator delete (void *p, size_t s); 118 void operator delete (void *p, size_t s);
362} 373}
363 374
364 375
365template<typename T> 376template<typename T>
366struct vector : simplevec<T> 377struct vector : simplevec<T>
367{ }; 378{
379};
368 380
369struct stringvec : simplevec<char *> 381struct stringvec : simplevec<char *>
370{ 382{
371 ~stringvec () 383 ~stringvec ()
372 { 384 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines