blob: 33808ede8d51b3fb17ebd59ea14ac89c58b13835 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/*
* basics.hpp
* Akupara
*
* Created by Udi on 12/19/06.
* Copyright 2006 __MyCompanyName__. All rights reserved.
*
*/
#if !defined(_AKUPARA_BASICS_HPP__INCLUDED_)
#define _AKUPARA_BASICS_HPP__INCLUDED_
#include "WavesPublicAPI/wstdint.h"
namespace Akupara
{
// The ultimate nothingness
// This is useful for writing constructors that nullify their object, and for testing nullness
struct null_type
{
null_type() {}
null_type(const null_type *) {} // this allows 0 to be implicitly converted to null_type
};
inline null_type null() { return null_type(); }
// This is a byte, guaranteed to be unsigned regardless of your compiler's char signedness
typedef uint8_t byte_type;
// derive from this if your class needs to be noncopyable
class noncopyable_type
{
private:
noncopyable_type(const noncopyable_type &);
noncopyable_type &operator=(const noncopyable_type &);
public:
noncopyable_type() {}
};
} // namespace Akupara
#if defined(__GNUC__)
#define AKUPARA_EXPECT_FALSE(x) __builtin_expect(x,false)
#define AKUPARA_EXPECT_TRUE(x) __builtin_expect(x,true )
#else
#define AKUPARA_EXPECT_FALSE(x) x
#define AKUPARA_EXPECT_TRUE(x) x
#endif // __GNUC__
#endif // _AKUPARA_BASICS_HPP__INCLUDED_
|