Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
10 changed files
with
442 additions
and
43 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
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
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,12 @@ | ||
#ifndef LIEF_CONVERT_H_ | ||
#define LIEF_CONVERT_H_ | ||
|
||
namespace LIEF { | ||
namespace Convert { | ||
|
||
template<typename X> | ||
void swap_endian(X* x); | ||
} | ||
} | ||
|
||
#endif // LIEF_CONVERT_H_ |
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
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
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,23 @@ | ||
#include "LIEF/BinaryStream/Convert.hpp" | ||
#include "LIEF/BinaryStream/BinaryStream.hpp" | ||
|
||
/* In place conversions for BinaryStream/VectorStream data */ | ||
|
||
namespace LIEF { | ||
namespace Convert { | ||
|
||
template<typename T> | ||
void swap_endian(T *v) { | ||
static_assert(std::is_integral<T>::value, "Only integer types can use generic endian swap"); | ||
*v = BinaryStream::swap_endian(*v); | ||
} | ||
|
||
/* | ||
* Force instantiation of template for types used | ||
*/ | ||
template void swap_endian<uint16_t>(uint16_t *v); | ||
template void swap_endian<uint32_t>(uint32_t *v); | ||
template void swap_endian<uint64_t>(uint64_t *v); | ||
|
||
} | ||
} |
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
Oops, something went wrong.