File:  [Isaki's NoNo m68k/m88k emulator] / nono / lib / bitrev.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed Apr 29 17:04:54 2026 UTC (3 months ago) by root
Branches: MAIN, Isaki
CVS tags: v011, HEAD
nono 0.2.0

//
// nono
// Copyright (C) 2020 nono project
// Licensed under nono-license.txt
//

#pragma once

#include "header.h"

extern const uint8 bitrev_table[256];

// 8ビットを左右反転する (定数用)
static constexpr uint8 _rev8(uint8 x)
{
	x = ((x & 0x0f) << 4) | ((x >> 4) & 0x0f);
	x = ((x & 0x33) << 2) | ((x >> 2) & 0x33);
	x = ((x & 0x55) << 1) | ((x >> 1) & 0x55);
	return x;
}

// 8ビットを左右反転する (実行時用)
static inline uint8
bitrev(uint8 x)
{
	return bitrev_table[x];
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.