diff options
author | Josh Blum | 2012-09-20 18:10:34 -0700 |
---|---|---|
committer | Josh Blum | 2012-09-20 18:10:34 -0700 |
commit | 70d6105c6a5356e2b5dadeae45751239c080cace (patch) | |
tree | 7cc4ac9c1ecf3cd83f9c686c533751596ec984ac /include/gnuradio | |
parent | 6fed7c8bd373fcde314afeac8e0b110b642c31c6 (diff) | |
download | sandhi-70d6105c6a5356e2b5dadeae45751239c080cace.tar.gz sandhi-70d6105c6a5356e2b5dadeae45751239c080cace.tar.bz2 sandhi-70d6105c6a5356e2b5dadeae45751239c080cace.zip |
fun with inlines
Diffstat (limited to 'include/gnuradio')
-rw-r--r-- | include/gnuradio/gras.hpp | 9 | ||||
-rw-r--r-- | include/gnuradio/sbuffer.ipp | 26 |
2 files changed, 25 insertions, 10 deletions
diff --git a/include/gnuradio/gras.hpp b/include/gnuradio/gras.hpp index 1e0087a..3b7c651 100644 --- a/include/gnuradio/gras.hpp +++ b/include/gnuradio/gras.hpp @@ -27,6 +27,15 @@ #define GRAS_MAX_ALIGNMENT 32 +//define cross platform attribute macros +#if defined(BOOST_MSVC) + #define GRAS_FORCE_INLINE __forceinline +#elif defined(__GNUG__) && __GNUG__ >= 4 + #define GRAS_FORCE_INLINE inline __attribute__((always_inline)) +#else + #define GRAS_FORCE_INLINE inline +#endif + namespace gnuradio { diff --git a/include/gnuradio/sbuffer.ipp b/include/gnuradio/sbuffer.ipp index 15719b6..7ecc974 100644 --- a/include/gnuradio/sbuffer.ipp +++ b/include/gnuradio/sbuffer.ipp @@ -32,19 +32,18 @@ struct SBufferImpl } boost::detail::atomic_count count; - size_t __pad; //avoid a probably non-issue w/ count SBufferConfig config; }; extern GRAS_API void sbuffer_handle_deref(SBufferImpl *impl); -inline void intrusive_ptr_add_ref(SBufferImpl *impl) +GRAS_FORCE_INLINE void intrusive_ptr_add_ref(SBufferImpl *impl) { ++impl->count; } -inline void intrusive_ptr_release(SBufferImpl *impl) +GRAS_FORCE_INLINE void intrusive_ptr_release(SBufferImpl *impl) { if (--impl->count == 0) { @@ -52,37 +51,44 @@ inline void intrusive_ptr_release(SBufferImpl *impl) } } -inline void *SBuffer::get_actual_memory(void) const +GRAS_FORCE_INLINE SBuffer::SBuffer(void): + offset(0), + length(0) +{ + //NOP +} + +GRAS_FORCE_INLINE void *SBuffer::get_actual_memory(void) const { return (*this)->config.memory; } -inline size_t SBuffer::get_actual_length(void) const +GRAS_FORCE_INLINE size_t SBuffer::get_actual_length(void) const { return (*this)->config.length; } -inline void *SBuffer::get(const ptrdiff_t delta_bytes) const +GRAS_FORCE_INLINE void *SBuffer::get(const ptrdiff_t delta_bytes) const { return ((char *)(*this)->config.memory) + this->offset + delta_bytes; } -inline Affinity SBuffer::get_affinity(void) const +GRAS_FORCE_INLINE Affinity SBuffer::get_affinity(void) const { return (*this)->config.affinity; } -inline size_t SBuffer::get_user_index(void) const +GRAS_FORCE_INLINE size_t SBuffer::get_user_index(void) const { return (*this)->config.user_index; } -inline bool SBuffer::unique(void) const +GRAS_FORCE_INLINE bool SBuffer::unique(void) const { return (*this)->count == 1; } -inline size_t SBuffer::use_count(void) const +GRAS_FORCE_INLINE size_t SBuffer::use_count(void) const { return (*this)->count; } |