-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#ifndef BOOST_HASH2_DETAIL_REVERSE_HPP_INCLUDED | ||
#define BOOST_HASH2_DETAIL_REVERSE_HPP_INCLUDED | ||
|
||
// Copyright 2024 Peter Dimov. | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// https://www.boost.org/LICENSE_1_0.txt | ||
|
||
#include <cstdint> | ||
#include <cstring> | ||
|
||
namespace boost | ||
{ | ||
namespace hash2 | ||
{ | ||
namespace detail | ||
{ | ||
|
||
template<std::size_t N> void reverse( unsigned char (&d)[ N ], void const* s ) | ||
{ | ||
unsigned char const* s2 = static_cast<unsigned char const*>( s ); | ||
|
||
for( std::size_t i = 0; i < N; ++i ) | ||
{ | ||
d[ i ] = s2[ N-1-i ]; | ||
} | ||
} | ||
|
||
} // namespace detail | ||
} // namespace hash2 | ||
} // namespace boost | ||
|
||
#endif // #ifndef BOOST_HASH2_DETAIL_REVERSE_HPP_INCLUDED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters