GNU Radio 3.3.0 C++ API
gc_types.h
Go to the documentation of this file.
00001 /* -*- c -*- */
00002 /*
00003  * Copyright 2007 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License along
00018  * with this program; if not, write to the Free Software Foundation, Inc.,
00019  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00020  */
00021 
00022 #ifndef INCLUDED_GCELL_GC_TYPES_H
00023 #define INCLUDED_GCELL_GC_TYPES_H
00024 
00025 #include <stdint.h>
00026 #include <gcell/gc_cdefs.h>
00027 #include <gcell/compiler.h>
00028 
00029 __GC_BEGIN_DECLS
00030 
00031 #ifndef __cplusplus
00032 typedef int bool;
00033 #define true  1
00034 #define false 0
00035 #endif
00036 
00037 /*!
00038  * \brief 64-bit integer type representing an effective address (EA)
00039  *
00040  * This type is always 64-bits, regardless of whether we're
00041  * running in 32 or 64-bit mode.
00042  */
00043 typedef uint64_t        gc_eaddr_t;
00044 
00045 #if !defined(__SPU__)
00046 static inline void *
00047 ea_to_ptr(gc_eaddr_t ea)
00048 {
00049   // in 32-bit mode we're tossing the top 32-bits.
00050   return (void *) (uintptr_t) ea;
00051 }
00052 
00053 static inline gc_eaddr_t
00054 ptr_to_ea(void *p)
00055 {
00056   // two steps to avoid compiler warning in 32-bit mode.
00057   return (gc_eaddr_t) (uintptr_t) p;
00058 }
00059 #endif
00060 
00061 __GC_END_DECLS
00062 
00063 #endif /* INCLUDED_GCELL_GC_TYPES_H */