|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: #pragma once
8:
9: #include "header.h"
10:
11: extern const uint8 bitrev_table[256];
12:
13: // 8ビットを左右反転する (定数用)
14: static constexpr uint8 _rev8(uint8 x)
15: {
16: x = ((x & 0x0f) << 4) | ((x >> 4) & 0x0f);
17: x = ((x & 0x33) << 2) | ((x >> 2) & 0x33);
18: x = ((x & 0x55) << 1) | ((x >> 1) & 0x55);
19: return x;
20: }
21:
22: // 8ビットを左右反転する (実行時用)
23: static inline uint8
24: bitrev(uint8 x)
25: {
26: return bitrev_table[x];
27: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.