mirror of
https://github.com/TomHarte/CLK.git
synced 2026-04-20 10:17:05 +00:00
Factors out bit reversing from the HFE class.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// BitReverse.cpp
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 03/10/2017.
|
||||
// Copyright © 2017 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
#include "BitReverse.hpp"
|
||||
|
||||
void Storage::Data::BitReverse::reverse(std::vector<uint8_t> &vector) {
|
||||
for(auto &byte : vector) {
|
||||
byte =
|
||||
static_cast<uint8_t>(
|
||||
((byte & 0x01) << 7) |
|
||||
((byte & 0x02) << 5) |
|
||||
((byte & 0x04) << 3) |
|
||||
((byte & 0x08) << 1) |
|
||||
((byte & 0x10) >> 1) |
|
||||
((byte & 0x20) >> 3) |
|
||||
((byte & 0x40) >> 5) |
|
||||
((byte & 0x80) >> 7)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user