From 1a0095e6d0ca5115dd3889f76200b11ab5ad9de5 Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Sun, 24 Mar 2024 22:10:32 +0300 Subject: [PATCH] C: add be_to_le_ptr.h --- c-programming/math/be_to_le_ptr.h | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 c-programming/math/be_to_le_ptr.h diff --git a/c-programming/math/be_to_le_ptr.h b/c-programming/math/be_to_le_ptr.h new file mode 100644 index 0000000..c69f1a7 --- /dev/null +++ b/c-programming/math/be_to_le_ptr.h @@ -0,0 +1,11 @@ +/* + * be_to_le_ptr.h + * + * Useful for showing big-endian hexadecimal dumps on little-endian machines + * + * Author: Intel A80486DX2-66 + * License: Creative Commons Zero 1.0 Universal + */ + +#define BE_TO_LE_PTR(base, size, i) \ + (base) + ((size) * ((i) / (size)) + ((size) - 1) - ((i) % (size)))