ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/util.h
(Generate patch)

Comparing deliantra/server/include/util.h (file contents):
Revision 1.58 by root, Thu Nov 8 19:43:25 2007 UTC vs.
Revision 1.61 by root, Fri Jan 25 18:09:23 2008 UTC

21 21
22#ifndef UTIL_H__ 22#ifndef UTIL_H__
23#define UTIL_H__ 23#define UTIL_H__
24 24
25//#define PREFER_MALLOC 25//#define PREFER_MALLOC
26//#define DEBUG_SALLOC
26 27
27#if __GNUC__ >= 3 28#if __GNUC__ >= 3
28# define is_constant(c) __builtin_constant_p (c) 29# define is_constant(c) __builtin_constant_p (c)
29# define expect(expr,value) __builtin_expect ((expr),(value)) 30# define expect(expr,value) __builtin_expect ((expr),(value))
30# define prefetch(addr,rw,locality) __builtin_prefetch (addr, rw, locality) 31# define prefetch(addr,rw,locality) __builtin_prefetch (addr, rw, locality)
51 52
52#include <glib.h> 53#include <glib.h>
53 54
54#include <shstr.h> 55#include <shstr.h>
55#include <traits.h> 56#include <traits.h>
57
58#ifdef DEBUG_SALLOC
59# define g_slice_alloc0(s) debug_slice_alloc0(s)
60# define g_slice_alloc(s) debug_slice_alloc(s)
61# define g_slice_free1(s,p) debug_slice_free1(s,p)
62void *g_slice_alloc (unsigned long size);
63void *g_slice_alloc0 (unsigned long size);
64void g_slice_free1 (unsigned long size, void *ptr);
65#endif
56 66
57// use C0X decltype for auto declarations until ISO C++ sanctifies them (if ever) 67// use C0X decltype for auto declarations until ISO C++ sanctifies them (if ever)
58#define auto(var,expr) decltype(expr) var = (expr) 68#define auto(var,expr) decltype(expr) var = (expr)
59 69
60// very ugly macro that basicaly declares and initialises a variable 70// very ugly macro that basicaly declares and initialises a variable
547 assign ((char *)&dst, src, N); 557 assign ((char *)&dst, src, N);
548} 558}
549 559
550typedef double tstamp; 560typedef double tstamp;
551 561
552// return current time as timestampe 562// return current time as timestamp
553tstamp now (); 563tstamp now ();
554 564
555int similar_direction (int a, int b); 565int similar_direction (int a, int b);
556 566
557// like sprintf, but returns a "static" buffer 567// like sprintf, but returns a "static" buffer

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines