diff options
author | Brian Silver <bsilver@us.ibm.com> | 2015-04-01 13:40:48 -0500 |
---|---|---|
committer | Derk Rembold <rembold@de.ibm.com> | 2015-09-03 07:23:59 -0500 |
commit | dcffb125e8a2e455e082eee0c64b4579a8d7f2df (patch) | |
tree | 72e55bb9b192c98dbfb0dbc73b47f255375c6ad4 | |
parent | a27443669513fd74eda1bda6d826525c8165b987 (diff) | |
download | talos-sbe-dcffb125e8a2e455e082eee0c64b4579a8d7f2df.tar.gz talos-sbe-dcffb125e8a2e455e082eee0c64b4579a8d7f2df.zip |
Add variable_buffer::pointer()
Change-Id: I4018509b00898c6ce9706c62d2d956a1019126aa
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/16819
Reviewed-by: Thi N. Tran <thi@us.ibm.com>
Reviewed-by: PRACHI GUPTA <pragupta@us.ibm.com>
Reviewed-by: STEPHEN M. CPREK <smcprek@us.ibm.com>
Reviewed-by: Brian Silver <bsilver@us.ibm.com>
Tested-by: Brian Silver <bsilver@us.ibm.com>
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/20132
Tested-by: Jenkins Server
Reviewed-by: Derk Rembold <rembold@de.ibm.com>
-rw-r--r-- | import/hwpf/fapi2/include/buffer.H | 6 | ||||
-rw-r--r-- | import/hwpf/fapi2/include/buffer_base.H | 10 | ||||
-rw-r--r-- | import/hwpf/fapi2/include/buffer_parameters.H | 2 | ||||
-rw-r--r-- | import/hwpf/fapi2/include/variable_buffer.H | 6 |
4 files changed, 15 insertions, 9 deletions
diff --git a/import/hwpf/fapi2/include/buffer.H b/import/hwpf/fapi2/include/buffer.H index bec8b0d4..a4e9a359 100644 --- a/import/hwpf/fapi2/include/buffer.H +++ b/import/hwpf/fapi2/include/buffer.H @@ -236,6 +236,12 @@ namespace fapi2 /// @name Buffer Manipulation Functions ///@{ + /// + /// @brief Get a pointer to the buffer bits + /// @return Pointer to the buffer itself + /// + inline T* pointer(void) { return &this->iv_data; } + // Note: Many (all?) of these are not needed and the compiler complains // as the cast to T yields a better operator. There are here mainly for // documenation purposes. diff --git a/import/hwpf/fapi2/include/buffer_base.H b/import/hwpf/fapi2/include/buffer_base.H index 67efb288..db13bd59 100644 --- a/import/hwpf/fapi2/include/buffer_base.H +++ b/import/hwpf/fapi2/include/buffer_base.H @@ -207,12 +207,6 @@ namespace fapi2 /// inline const T& operator()(void) const { return iv_data; } - /// - /// @brief Get a pointer to the buffer bits - /// @return Pointer to the buffer itself - /// - inline T* pointer(void) { return &iv_data; } - /// @name Buffer Manipulation Functions ///@{ @@ -239,7 +233,7 @@ namespace fapi2 // as what we're trying to prevent is overflow, which this should do. // const uint32_t length = TT:: template size<OT>(iv_data); - static const bits_type bits_in_value = parameterTraits<OT>::bit_length; + static const bits_type bits_in_value = parameterTraits<OT>::bit_length(); const bits_type bit_length = TT::bit_length(iv_data); if (i_offset >= length) @@ -251,7 +245,7 @@ namespace fapi2 // Shift it left by the amount of unused bits, // Clear the unused bits if (((i_offset + 1) == length) && (bit_length % bits_in_value)) { - i_value &= parameterTraits<OT>::mask << ((bits_in_value * length) - bit_length); + i_value &= parameterTraits<OT>::mask() << ((bits_in_value * length) - bit_length); } parameterTraits<OT>::template write_element<unit_type>(TT::get_address(iv_data), i_value, i_offset); diff --git a/import/hwpf/fapi2/include/buffer_parameters.H b/import/hwpf/fapi2/include/buffer_parameters.H index 1ad9ba43..2a6e6100 100644 --- a/import/hwpf/fapi2/include/buffer_parameters.H +++ b/import/hwpf/fapi2/include/buffer_parameters.H @@ -44,7 +44,7 @@ namespace fapi2 // Why constexpr functions? Enums are hard to do math on, and // static const doesn't work without -O1 (or greater.) That might // be a bug in g++ but this works just the same. - constexpr static uint32_t mask(void) + constexpr static T mask(void) { return T(~0); } constexpr static uint32_t byte_length(void) diff --git a/import/hwpf/fapi2/include/variable_buffer.H b/import/hwpf/fapi2/include/variable_buffer.H index 38c7a4a5..f25f2b4d 100644 --- a/import/hwpf/fapi2/include/variable_buffer.H +++ b/import/hwpf/fapi2/include/variable_buffer.H @@ -492,6 +492,12 @@ namespace fapi2 #endif /// + /// @brief Get a pointer to the buffer bits + /// @return Pointer to the buffer itself + /// + inline unit_type* pointer(void) { return &(iv_data[0]); } + + /// /// @brief operator!=() /// bool operator!=(const variable_buffer& rhs) const |