Imported Upstream version 3.2.2
[debian/gnuradio] / gcell / include / gcell / gc_types.h
1 /* -*- c -*- */
2 /*
3  * Copyright 2007 Free Software Foundation, Inc.
4  * 
5  * This file is part of GNU Radio
6  * 
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  * 
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #ifndef INCLUDED_GCELL_GC_TYPES_H
23 #define INCLUDED_GCELL_GC_TYPES_H
24
25 #include <stdint.h>
26 #include <gcell/gc_cdefs.h>
27 #include <gcell/compiler.h>
28
29 __GC_BEGIN_DECLS
30
31 #ifndef __cplusplus
32 typedef int bool;
33 #define true  1
34 #define false 0
35 #endif
36
37 /*!
38  * \brief 64-bit integer type representing an effective address (EA)
39  *
40  * This type is always 64-bits, regardless of whether we're
41  * running in 32 or 64-bit mode.
42  */
43 typedef uint64_t        gc_eaddr_t;
44
45 #if !defined(__SPU__)
46 static inline void *
47 ea_to_ptr(gc_eaddr_t ea)
48 {
49   // in 32-bit mode we're tossing the top 32-bits.
50   return (void *) (uintptr_t) ea;
51 }
52
53 static inline gc_eaddr_t
54 ptr_to_ea(void *p)
55 {
56   // two steps to avoid compiler warning in 32-bit mode.
57   return (gc_eaddr_t) (uintptr_t) p;
58 }
59 #endif
60
61 __GC_END_DECLS
62
63 #endif /* INCLUDED_GCELL_GC_TYPES_H */