Skip to content

Commit 4a7e405

Browse files
author
Alexander Grund
committed
Use CHAR_BIT for C++98 compatibility
1 parent 61c4c10 commit 4a7e405

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/libPMacc/include/algorithms/reverseBits.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
#include "static_assert.hpp"
2727
#include <boost/type_traits.hpp>
28-
#include <limits>
28+
#include <climits>
2929

3030
namespace PMacc {
3131

@@ -48,7 +48,7 @@ reverseBits(T value)
4848
/* init with value (to get LSB) */
4949
T result = value;
5050
/* extra shift needed at end */
51-
int s = std::numeric_limits<T>::digits - 1;
51+
int s = sizeof(T) * CHAR_BIT - 1;
5252
for (value >>= 1; value; value >>= 1)
5353
{
5454
result <<= 1;

src/libPMacc/include/mpi/SeedPerRank.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ namespace mpi
6868
/* localSeed often contains a counted number, so we rotate it by some bits to not "destroy"
6969
* the counted rank that is already there. Also it is not reversed to get a different pattern
7070
*/
71-
localSeed = (localSeed << 16) | (localSeed >> (std::numeric_limits<uint32_t>::digits - 16));
71+
localSeed = (localSeed << 16) | (localSeed >> (sizeof(uint32_t) * CHAR_BIT - 16));
7272
globalUniqueSeed ^= localSeed;
7373
/* For any globally constant localSeed globalUniqueSeed is now guaranteed
7474
* to be globally unique

0 commit comments

Comments
 (0)