1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-25 16:31:42 +00:00

Adds some further `costs.

This commit is contained in:
Thomas Harte 2020-05-09 23:03:33 -04:00
parent 25996ce180
commit 05c3f2a30d
3 changed files with 6 additions and 6 deletions

View File

@ -11,14 +11,14 @@
#include <cstdlib>
void Memory::Fuzz(uint8_t *buffer, std::size_t size) {
unsigned int divider = (unsigned(RAND_MAX) + 1) / 256;
const unsigned int divider = (unsigned(RAND_MAX) + 1) / 256;
unsigned int shift = 1, value = 1;
while(value < divider) {
value <<= 1;
shift++;
++shift;
}
for(std::size_t c = 0; c < size; c++) {
for(size_t c = 0; c < size; c++) {
buffer[c] = uint8_t(std::rand() >> shift);
}
}

View File

@ -9,7 +9,7 @@
#include "MemoryPacker.hpp"
void Memory::PackBigEndian16(const std::vector<uint8_t> &source, uint16_t *target) {
for(std::size_t c = 0; c < source.size(); c += 2) {
for(size_t c = 0; c < source.size(); c += 2) {
target[c >> 1] = uint16_t(source[c] << 8) | uint16_t(source[c+1]);
}
}

View File

@ -86,11 +86,11 @@ class Typer {
std::string string_;
std::size_t string_pointer_ = 0;
HalfCycles frequency_;
const HalfCycles frequency_;
HalfCycles counter_;
int phase_ = 0;
Delegate *delegate_;
Delegate *const delegate_;
CharacterMapper &character_mapper_;
uint16_t try_type_next_character();