mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-13 07:30:21 +00:00
Commutes uint8_t *
, uint16_t *
, uint32_t *
, size_t
, off_t
and long
to functional-style casts.
This commit is contained in:
parent
e983854e71
commit
ad9df4bb90
@ -141,7 +141,7 @@ template <class T> class MOS6560 {
|
||||
// }
|
||||
|
||||
for(int c = 0; c < 16; c++) {
|
||||
uint8_t *colour = (uint8_t *)&colours_[c];
|
||||
uint8_t *colour = reinterpret_cast<uint8_t *>(&colours_[c]);
|
||||
colour[0] = luminances[c];
|
||||
colour[1] = chrominances[c];
|
||||
}
|
||||
@ -270,7 +270,7 @@ template <class T> class MOS6560 {
|
||||
|
||||
pixel_pointer = nullptr;
|
||||
if(output_state_ == State::Pixels) {
|
||||
pixel_pointer = (uint16_t *)crt_->allocate_write_area(260);
|
||||
pixel_pointer = reinterpret_cast<uint16_t *>(crt_->allocate_write_area(260));
|
||||
}
|
||||
}
|
||||
cycles_in_state_++;
|
||||
@ -454,7 +454,7 @@ template <class T> class MOS6560 {
|
||||
|
||||
uint16_t *pixel_pointer;
|
||||
void output_border(unsigned int number_of_cycles) {
|
||||
uint16_t *colour_pointer = (uint16_t *)crt_->allocate_write_area(1);
|
||||
uint16_t *colour_pointer = reinterpret_cast<uint16_t *>(crt_->allocate_write_area(1));
|
||||
if(colour_pointer) *colour_pointer = registers_.borderColour;
|
||||
crt_->output_level(number_of_cycles);
|
||||
}
|
||||
|
@ -221,26 +221,26 @@ class CRTCBusHandler {
|
||||
// fetch two bytes and translate into pixels
|
||||
switch(mode_) {
|
||||
case 0:
|
||||
((uint16_t *)pixel_pointer_)[0] = mode0_output_[ram_[address]];
|
||||
((uint16_t *)pixel_pointer_)[1] = mode0_output_[ram_[address+1]];
|
||||
reinterpret_cast<uint16_t *>(pixel_pointer_)[0] = mode0_output_[ram_[address]];
|
||||
reinterpret_cast<uint16_t *>(pixel_pointer_)[1] = mode0_output_[ram_[address+1]];
|
||||
pixel_pointer_ += 4;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
((uint32_t *)pixel_pointer_)[0] = mode1_output_[ram_[address]];
|
||||
((uint32_t *)pixel_pointer_)[1] = mode1_output_[ram_[address+1]];
|
||||
reinterpret_cast<uint32_t *>(pixel_pointer_)[0] = mode1_output_[ram_[address]];
|
||||
reinterpret_cast<uint32_t *>(pixel_pointer_)[1] = mode1_output_[ram_[address+1]];
|
||||
pixel_pointer_ += 8;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
((uint64_t *)pixel_pointer_)[0] = mode2_output_[ram_[address]];
|
||||
((uint64_t *)pixel_pointer_)[1] = mode2_output_[ram_[address+1]];
|
||||
reinterpret_cast<uint64_t *>(pixel_pointer_)[0] = mode2_output_[ram_[address]];
|
||||
reinterpret_cast<uint64_t *>(pixel_pointer_)[1] = mode2_output_[ram_[address+1]];
|
||||
pixel_pointer_ += 16;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
((uint16_t *)pixel_pointer_)[0] = mode3_output_[ram_[address]];
|
||||
((uint16_t *)pixel_pointer_)[1] = mode3_output_[ram_[address+1]];
|
||||
reinterpret_cast<uint16_t *>(pixel_pointer_)[0] = mode3_output_[ram_[address]];
|
||||
reinterpret_cast<uint16_t *>(pixel_pointer_)[1] = mode3_output_[ram_[address+1]];
|
||||
pixel_pointer_ += 4;
|
||||
break;
|
||||
|
||||
@ -344,7 +344,7 @@ class CRTCBusHandler {
|
||||
|
||||
private:
|
||||
void output_border(unsigned int length) {
|
||||
uint8_t *colour_pointer = (uint8_t *)crt_->allocate_write_area(1);
|
||||
uint8_t *colour_pointer = static_cast<uint8_t *>(crt_->allocate_write_area(1));
|
||||
if(colour_pointer) *colour_pointer = border_;
|
||||
crt_->output_level(length * 16);
|
||||
}
|
||||
@ -381,7 +381,7 @@ class CRTCBusHandler {
|
||||
// Mode 0: abcdefgh -> [gcea] [hdfb]
|
||||
for(int c = 0; c < 256; c++) {
|
||||
// prepare mode 0
|
||||
uint8_t *mode0_pixels = (uint8_t *)&mode0_output_[c];
|
||||
uint8_t *mode0_pixels = reinterpret_cast<uint8_t *>(&mode0_output_[c]);
|
||||
mode0_pixels[0] = palette_[Mode0Colour0(c)];
|
||||
mode0_pixels[1] = palette_[Mode0Colour1(c)];
|
||||
}
|
||||
@ -390,7 +390,7 @@ class CRTCBusHandler {
|
||||
case 1:
|
||||
for(int c = 0; c < 256; c++) {
|
||||
// prepare mode 1
|
||||
uint8_t *mode1_pixels = (uint8_t *)&mode1_output_[c];
|
||||
uint8_t *mode1_pixels = reinterpret_cast<uint8_t *>(&mode1_output_[c]);
|
||||
mode1_pixels[0] = palette_[Mode1Colour0(c)];
|
||||
mode1_pixels[1] = palette_[Mode1Colour1(c)];
|
||||
mode1_pixels[2] = palette_[Mode1Colour2(c)];
|
||||
@ -401,7 +401,7 @@ class CRTCBusHandler {
|
||||
case 2:
|
||||
for(int c = 0; c < 256; c++) {
|
||||
// prepare mode 2
|
||||
uint8_t *mode2_pixels = (uint8_t *)&mode2_output_[c];
|
||||
uint8_t *mode2_pixels = reinterpret_cast<uint8_t *>(&mode2_output_[c]);
|
||||
mode2_pixels[0] = palette_[((c & 0x80) >> 7)];
|
||||
mode2_pixels[1] = palette_[((c & 0x40) >> 6)];
|
||||
mode2_pixels[2] = palette_[((c & 0x20) >> 5)];
|
||||
@ -416,7 +416,7 @@ class CRTCBusHandler {
|
||||
case 3:
|
||||
for(int c = 0; c < 256; c++) {
|
||||
// prepare mode 3
|
||||
uint8_t *mode3_pixels = (uint8_t *)&mode3_output_[c];
|
||||
uint8_t *mode3_pixels = reinterpret_cast<uint8_t *>(&mode3_output_[c]);
|
||||
mode3_pixels[0] = palette_[Mode3Colour0(c)];
|
||||
mode3_pixels[1] = palette_[Mode3Colour1(c)];
|
||||
}
|
||||
@ -428,7 +428,7 @@ class CRTCBusHandler {
|
||||
switch(mode_) {
|
||||
case 0: {
|
||||
for(uint8_t c : mode0_palette_hits_[pen]) {
|
||||
uint8_t *mode0_pixels = (uint8_t *)&mode0_output_[c];
|
||||
uint8_t *mode0_pixels = reinterpret_cast<uint8_t *>(&mode0_output_[c]);
|
||||
mode0_pixels[0] = palette_[Mode0Colour0(c)];
|
||||
mode0_pixels[1] = palette_[Mode0Colour1(c)];
|
||||
}
|
||||
@ -436,7 +436,7 @@ class CRTCBusHandler {
|
||||
case 1:
|
||||
if(pen > 3) return;
|
||||
for(uint8_t c : mode1_palette_hits_[pen]) {
|
||||
uint8_t *mode1_pixels = (uint8_t *)&mode1_output_[c];
|
||||
uint8_t *mode1_pixels = reinterpret_cast<uint8_t *>(&mode1_output_[c]);
|
||||
mode1_pixels[0] = palette_[Mode1Colour0(c)];
|
||||
mode1_pixels[1] = palette_[Mode1Colour1(c)];
|
||||
mode1_pixels[2] = palette_[Mode1Colour2(c)];
|
||||
@ -453,7 +453,7 @@ class CRTCBusHandler {
|
||||
if(pen > 3) return;
|
||||
// Same argument applies here as to case 1, as the unused bits aren't masked out.
|
||||
for(uint8_t c : mode3_palette_hits_[pen]) {
|
||||
uint8_t *mode3_pixels = (uint8_t *)&mode3_output_[c];
|
||||
uint8_t *mode3_pixels = reinterpret_cast<uint8_t *>(&mode3_output_[c]);
|
||||
mode3_pixels[0] = palette_[Mode3Colour0(c)];
|
||||
mode3_pixels[1] = palette_[Mode3Colour1(c)];
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ void TIA::draw_playfield(int start, int end) {
|
||||
while(aligned_position < end) {
|
||||
int offset = (aligned_position - first_pixel_cycle) >> 2;
|
||||
uint32_t value = ((background_[(offset/20)&background_half_mask_] >> (offset%20))&1) * 0x01010101;
|
||||
*(uint32_t *)&collision_buffer_[aligned_position - first_pixel_cycle] |= value;
|
||||
*reinterpret_cast<uint32_t *>(&collision_buffer_[aligned_position - first_pixel_cycle]) |= value;
|
||||
aligned_position += 4;
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class ConcreteMachine:
|
||||
break;
|
||||
}
|
||||
|
||||
memcpy(target, &data[0], std::min((size_t)16384, data.size()));
|
||||
memcpy(target, &data[0], std::min(static_cast<size_t>(16384), data.size()));
|
||||
}
|
||||
|
||||
void set_key_state(uint16_t key, bool isPressed) override final {
|
||||
|
@ -121,7 +121,7 @@ void VideoOutput::output_pixels(unsigned int number_of_cycles) {
|
||||
if(initial_output_target_) {
|
||||
while(number_of_cycles--) {
|
||||
get_pixel();
|
||||
*(uint32_t *)current_output_target_ = palette_tables_.eighty1bpp[last_pixel_byte_];
|
||||
*reinterpret_cast<uint32_t *>(current_output_target_) = palette_tables_.eighty1bpp[last_pixel_byte_];
|
||||
current_output_target_ += 4;
|
||||
current_pixel_column_++;
|
||||
}
|
||||
@ -132,7 +132,7 @@ void VideoOutput::output_pixels(unsigned int number_of_cycles) {
|
||||
if(initial_output_target_) {
|
||||
while(number_of_cycles--) {
|
||||
get_pixel();
|
||||
*(uint16_t *)current_output_target_ = palette_tables_.eighty2bpp[last_pixel_byte_];
|
||||
*reinterpret_cast<uint16_t *>(current_output_target_) = palette_tables_.eighty2bpp[last_pixel_byte_];
|
||||
current_output_target_ += 2;
|
||||
current_pixel_column_++;
|
||||
}
|
||||
@ -154,7 +154,7 @@ void VideoOutput::output_pixels(unsigned int number_of_cycles) {
|
||||
if(initial_output_target_) {
|
||||
if(current_pixel_column_&1) {
|
||||
last_pixel_byte_ <<= 4;
|
||||
*(uint16_t *)current_output_target_ = palette_tables_.forty1bpp[last_pixel_byte_];
|
||||
*reinterpret_cast<uint16_t *>(current_output_target_) = palette_tables_.forty1bpp[last_pixel_byte_];
|
||||
current_output_target_ += 2;
|
||||
|
||||
number_of_cycles--;
|
||||
@ -162,11 +162,11 @@ void VideoOutput::output_pixels(unsigned int number_of_cycles) {
|
||||
}
|
||||
while(number_of_cycles > 1) {
|
||||
get_pixel();
|
||||
*(uint16_t *)current_output_target_ = palette_tables_.forty1bpp[last_pixel_byte_];
|
||||
*reinterpret_cast<uint16_t *>(current_output_target_) = palette_tables_.forty1bpp[last_pixel_byte_];
|
||||
current_output_target_ += 2;
|
||||
|
||||
last_pixel_byte_ <<= 4;
|
||||
*(uint16_t *)current_output_target_ = palette_tables_.forty1bpp[last_pixel_byte_];
|
||||
*reinterpret_cast<uint16_t *>(current_output_target_) = palette_tables_.forty1bpp[last_pixel_byte_];
|
||||
current_output_target_ += 2;
|
||||
|
||||
number_of_cycles -= 2;
|
||||
@ -174,7 +174,7 @@ void VideoOutput::output_pixels(unsigned int number_of_cycles) {
|
||||
}
|
||||
if(number_of_cycles) {
|
||||
get_pixel();
|
||||
*(uint16_t *)current_output_target_ = palette_tables_.forty1bpp[last_pixel_byte_];
|
||||
*reinterpret_cast<uint16_t *>(current_output_target_) = palette_tables_.forty1bpp[last_pixel_byte_];
|
||||
current_output_target_ += 2;
|
||||
current_pixel_column_++;
|
||||
}
|
||||
@ -294,15 +294,15 @@ void VideoOutput::set_register(int address, uint8_t value) {
|
||||
// regenerate all palette tables for now
|
||||
#define pack(a, b) static_cast<uint8_t>((a << 4) | (b))
|
||||
for(int byte = 0; byte < 256; byte++) {
|
||||
uint8_t *target = (uint8_t *)&palette_tables_.forty1bpp[byte];
|
||||
uint8_t *target = reinterpret_cast<uint8_t *>(&palette_tables_.forty1bpp[byte]);
|
||||
target[0] = pack(palette_[(byte&0x80) >> 4], palette_[(byte&0x40) >> 3]);
|
||||
target[1] = pack(palette_[(byte&0x20) >> 2], palette_[(byte&0x10) >> 1]);
|
||||
|
||||
target = (uint8_t *)&palette_tables_.eighty2bpp[byte];
|
||||
target = reinterpret_cast<uint8_t *>(&palette_tables_.eighty2bpp[byte]);
|
||||
target[0] = pack(palette_[((byte&0x80) >> 4) | ((byte&0x08) >> 2)], palette_[((byte&0x40) >> 3) | ((byte&0x04) >> 1)]);
|
||||
target[1] = pack(palette_[((byte&0x20) >> 2) | ((byte&0x02) >> 0)], palette_[((byte&0x10) >> 1) | ((byte&0x01) << 1)]);
|
||||
|
||||
target = (uint8_t *)&palette_tables_.eighty1bpp[byte];
|
||||
target = reinterpret_cast<uint8_t *>(&palette_tables_.eighty1bpp[byte]);
|
||||
target[0] = pack(palette_[(byte&0x80) >> 4], palette_[(byte&0x40) >> 3]);
|
||||
target[1] = pack(palette_[(byte&0x20) >> 2], palette_[(byte&0x10) >> 1]);
|
||||
target[2] = pack(palette_[(byte&0x08) >> 0], palette_[(byte&0x04) << 1]);
|
||||
|
@ -63,7 +63,7 @@ void VideoOutput::set_colour_rom(const std::vector<uint8_t> &rom) {
|
||||
|
||||
// check for big endianness and byte swap if required
|
||||
uint16_t test_value = 0x0001;
|
||||
if(*(uint8_t *)&test_value != 0x01) {
|
||||
if(*reinterpret_cast<uint8_t *>(&test_value) != 0x01) {
|
||||
for(size_t c = 0; c < 8; c++) {
|
||||
colour_forms_[c] = static_cast<uint16_t>((colour_forms_[c] >> 8) | (colour_forms_[c] << 8));
|
||||
}
|
||||
@ -97,7 +97,7 @@ void VideoOutput::run_for(const Cycles cycles) {
|
||||
paper_ = 0x0;
|
||||
use_alternative_character_set_ = use_double_height_characters_ = blink_text_ = false;
|
||||
set_character_set_base_address();
|
||||
pixel_target_ = (uint16_t *)crt_->allocate_write_area(240);
|
||||
pixel_target_ = reinterpret_cast<uint16_t *>(crt_->allocate_write_area(240, 2));
|
||||
|
||||
if(!counter_) {
|
||||
frame_counter_++;
|
||||
|
@ -58,7 +58,7 @@ void Video::flush(bool next_sync) {
|
||||
}
|
||||
|
||||
// Any pending pixels being dealt with, pad with the white level.
|
||||
uint8_t *colour_pointer = (uint8_t *)crt_->allocate_write_area(1);
|
||||
uint8_t *colour_pointer = static_cast<uint8_t *>(crt_->allocate_write_area(1));
|
||||
if(colour_pointer) *colour_pointer = 0xff;
|
||||
crt_->output_level(cycles_since_update_);
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ template<bool is_zx81> class ConcreteMachine:
|
||||
z80_.set_interrupt_line(false);
|
||||
}
|
||||
if(has_latched_video_byte_) {
|
||||
size_t char_address = (size_t)((address & 0xfe00) | ((latched_video_byte_ & 0x3f) << 3) | line_counter_);
|
||||
size_t char_address = static_cast<size_t>((address & 0xfe00) | ((latched_video_byte_ & 0x3f) << 3) | line_counter_);
|
||||
uint8_t mask = (latched_video_byte_ & 0x80) ? 0x00 : 0xff;
|
||||
if(char_address < ram_base_) {
|
||||
latched_video_byte_ = rom_[char_address & rom_mask_] ^ mask;
|
||||
|
@ -120,17 +120,17 @@ Flywheel::SyncEvent CRT::get_next_horizontal_sync_event(bool hsync_is_requested,
|
||||
return horizontal_flywheel_->get_next_event_in_period(hsync_is_requested, cycles_to_run_for, cycles_advanced);
|
||||
}
|
||||
|
||||
#define output_x1() (*(uint16_t *)&next_output_run[OutputVertexOffsetOfHorizontal + 0])
|
||||
#define output_x2() (*(uint16_t *)&next_output_run[OutputVertexOffsetOfHorizontal + 2])
|
||||
#define output_position_y() (*(uint16_t *)&next_output_run[OutputVertexOffsetOfVertical + 0])
|
||||
#define output_tex_y() (*(uint16_t *)&next_output_run[OutputVertexOffsetOfVertical + 2])
|
||||
#define output_x1() (*reinterpret_cast<uint16_t *>(&next_output_run[OutputVertexOffsetOfHorizontal + 0]))
|
||||
#define output_x2() (*reinterpret_cast<uint16_t *>(&next_output_run[OutputVertexOffsetOfHorizontal + 2]))
|
||||
#define output_position_y() (*reinterpret_cast<uint16_t *>(&next_output_run[OutputVertexOffsetOfVertical + 0]))
|
||||
#define output_tex_y() (*reinterpret_cast<uint16_t *>(&next_output_run[OutputVertexOffsetOfVertical + 2]))
|
||||
|
||||
#define source_input_position_x1() (*(uint16_t *)&next_run[SourceVertexOffsetOfInputStart + 0])
|
||||
#define source_input_position_y() (*(uint16_t *)&next_run[SourceVertexOffsetOfInputStart + 2])
|
||||
#define source_input_position_x2() (*(uint16_t *)&next_run[SourceVertexOffsetOfEnds + 0])
|
||||
#define source_output_position_x1() (*(uint16_t *)&next_run[SourceVertexOffsetOfOutputStart + 0])
|
||||
#define source_output_position_y() (*(uint16_t *)&next_run[SourceVertexOffsetOfOutputStart + 2])
|
||||
#define source_output_position_x2() (*(uint16_t *)&next_run[SourceVertexOffsetOfEnds + 2])
|
||||
#define source_input_position_x1() (*reinterpret_cast<uint16_t *>(&next_run[SourceVertexOffsetOfInputStart + 0]))
|
||||
#define source_input_position_y() (*reinterpret_cast<uint16_t *>(&next_run[SourceVertexOffsetOfInputStart + 2]))
|
||||
#define source_input_position_x2() (*reinterpret_cast<uint16_t *>(&next_run[SourceVertexOffsetOfEnds + 0]))
|
||||
#define source_output_position_x1() (*reinterpret_cast<uint16_t *>(&next_run[SourceVertexOffsetOfOutputStart + 0]))
|
||||
#define source_output_position_y() (*reinterpret_cast<uint16_t *>(&next_run[SourceVertexOffsetOfOutputStart + 2]))
|
||||
#define source_output_position_x2() (*reinterpret_cast<uint16_t *>(&next_run[SourceVertexOffsetOfEnds + 2]))
|
||||
#define source_phase() next_run[SourceVertexOffsetOfPhaseTimeAndAmplitude + 0]
|
||||
#define source_amplitude() next_run[SourceVertexOffsetOfPhaseTimeAndAmplitude + 1]
|
||||
|
||||
@ -223,13 +223,13 @@ void CRT::advance_cycles(unsigned int number_of_cycles, bool hsync_requested, bo
|
||||
[=] (const std::vector<TextureBuilder::WriteArea> &write_areas, size_t number_of_write_areas) {
|
||||
assert(number_of_write_areas * SourceVertexSize == input_size);
|
||||
for(size_t run = 0; run < number_of_write_areas; run++) {
|
||||
*(uint16_t *)&input_buffer[run * SourceVertexSize + SourceVertexOffsetOfInputStart + 0] = write_areas[run].x;
|
||||
*(uint16_t *)&input_buffer[run * SourceVertexSize + SourceVertexOffsetOfInputStart + 2] = write_areas[run].y;
|
||||
*(uint16_t *)&input_buffer[run * SourceVertexSize + SourceVertexOffsetOfEnds + 0] = write_areas[run].x + write_areas[run].length;
|
||||
*reinterpret_cast<uint16_t *>(&input_buffer[run * SourceVertexSize + SourceVertexOffsetOfInputStart + 0]) = write_areas[run].x;
|
||||
*reinterpret_cast<uint16_t *>(&input_buffer[run * SourceVertexSize + SourceVertexOffsetOfInputStart + 2]) = write_areas[run].y;
|
||||
*reinterpret_cast<uint16_t *>(&input_buffer[run * SourceVertexSize + SourceVertexOffsetOfEnds + 0]) = write_areas[run].x + write_areas[run].length;
|
||||
}
|
||||
});
|
||||
for(size_t position = 0; position < input_size; position += SourceVertexSize) {
|
||||
(*(uint16_t *)&input_buffer[position + SourceVertexOffsetOfOutputStart + 2]) = output_y;
|
||||
(*reinterpret_cast<uint16_t *>(&input_buffer[position + SourceVertexOffsetOfOutputStart + 2])) = output_y;
|
||||
}
|
||||
});
|
||||
colour_burst_amplitude_ = 0;
|
||||
|
@ -122,7 +122,7 @@ size_t ArrayBuilder::Buffer::submit(bool is_input) {
|
||||
submission_function_(is_input, data.data(), length);
|
||||
} else {
|
||||
glBindBuffer(GL_ARRAY_BUFFER, buffer);
|
||||
uint8_t *destination = (uint8_t *)glMapBufferRange(GL_ARRAY_BUFFER, 0, (GLsizeiptr)length, GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_FLUSH_EXPLICIT_BIT);
|
||||
uint8_t *destination = static_cast<uint8_t *>(glMapBufferRange(GL_ARRAY_BUFFER, 0, (GLsizeiptr)length, GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_FLUSH_EXPLICIT_BIT));
|
||||
memcpy(destination, data.data(), length);
|
||||
glFlushMappedBufferRange(GL_ARRAY_BUFFER, 0, (GLsizeiptr)length);
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
|
@ -29,7 +29,7 @@ GLuint Shader::compile_shader(const std::string &source, GLenum type) {
|
||||
GLint logLength;
|
||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &logLength);
|
||||
if(logLength > 0) {
|
||||
GLchar *log = new GLchar[(size_t)logLength];
|
||||
GLchar *log = new GLchar[static_cast<size_t>(logLength)];
|
||||
glGetShaderInfoLog(shader, logLength, &logLength, log);
|
||||
printf("Compile log:\n%s\n", log);
|
||||
delete[] log;
|
||||
@ -66,7 +66,7 @@ Shader::Shader(const std::string &vertex_shader, const std::string &fragment_sha
|
||||
GLint logLength;
|
||||
glGetProgramiv(shader_program_, GL_INFO_LOG_LENGTH, &logLength);
|
||||
if(logLength > 0) {
|
||||
GLchar *log = new GLchar[(size_t)logLength];
|
||||
GLchar *log = new GLchar[static_cast<size_t>(logLength)];
|
||||
glGetProgramInfoLog(shader_program_, logLength, &logLength, log);
|
||||
printf("Link log:\n%s\n", log);
|
||||
delete[] log;
|
||||
@ -186,9 +186,9 @@ void Shader::set_uniform(const std::string &name, GLuint value1, GLuint value2,
|
||||
}
|
||||
|
||||
void Shader::set_uniform(const std::string &name, GLint size, GLsizei count, const GLint *values) {
|
||||
size_t number_of_values = (size_t)count * (size_t)size;
|
||||
size_t number_of_values = static_cast<size_t>(count) * static_cast<size_t>(size);
|
||||
GLint *values_copy = new GLint[number_of_values];
|
||||
memcpy(values_copy, values, sizeof(*values) * (size_t)number_of_values);
|
||||
memcpy(values_copy, values, sizeof(*values) * static_cast<size_t>(number_of_values));
|
||||
|
||||
enqueue_function([name, size, count, values_copy, this] {
|
||||
switch(size) {
|
||||
@ -202,9 +202,9 @@ void Shader::set_uniform(const std::string &name, GLint size, GLsizei count, con
|
||||
}
|
||||
|
||||
void Shader::set_uniform(const std::string &name, GLint size, GLsizei count, const GLfloat *values) {
|
||||
size_t number_of_values = (size_t)count * (size_t)size;
|
||||
size_t number_of_values = static_cast<size_t>(count) * static_cast<size_t>(size);
|
||||
GLfloat *values_copy = new GLfloat[number_of_values];
|
||||
memcpy(values_copy, values, sizeof(*values) * (size_t)number_of_values);
|
||||
memcpy(values_copy, values, sizeof(*values) * static_cast<size_t>(number_of_values));
|
||||
|
||||
enqueue_function([name, size, count, values_copy, this] {
|
||||
switch(size) {
|
||||
@ -218,9 +218,9 @@ void Shader::set_uniform(const std::string &name, GLint size, GLsizei count, con
|
||||
}
|
||||
|
||||
void Shader::set_uniform(const std::string &name, GLint size, GLsizei count, const GLuint *values) {
|
||||
size_t number_of_values = (size_t)count * (size_t)size;
|
||||
size_t number_of_values = static_cast<size_t>(count) * static_cast<size_t>(size);
|
||||
GLuint *values_copy = new GLuint[number_of_values];
|
||||
memcpy(values_copy, values, sizeof(*values) * (size_t)number_of_values);
|
||||
memcpy(values_copy, values, sizeof(*values) * static_cast<size_t>(number_of_values));
|
||||
|
||||
enqueue_function([name, size, count, values_copy, this] {
|
||||
switch(size) {
|
||||
@ -238,7 +238,7 @@ void Shader::set_uniform_matrix(const std::string &name, GLint size, bool transp
|
||||
}
|
||||
|
||||
void Shader::set_uniform_matrix(const std::string &name, GLint size, GLsizei count, bool transpose, const GLfloat *values) {
|
||||
size_t number_of_values = (size_t)count * (size_t)size * (size_t)size;
|
||||
size_t number_of_values = static_cast<size_t>(count) * static_cast<size_t>(size) * static_cast<size_t>(size);
|
||||
GLfloat *values_copy = new GLfloat[number_of_values];
|
||||
memcpy(values_copy, values, sizeof(*values) * number_of_values);
|
||||
|
||||
|
@ -29,7 +29,7 @@ TextureTarget::TextureTarget(GLsizei width, GLsizei height, GLenum texture_unit,
|
||||
glGenTextures(1, &_texture);
|
||||
glActiveTexture(texture_unit);
|
||||
glBindTexture(GL_TEXTURE_2D, _texture);
|
||||
uint8_t *blank_buffer = (uint8_t *)calloc((size_t)(_expanded_width * _expanded_height), 4);
|
||||
uint8_t *blank_buffer = static_cast<uint8_t *>(calloc(static_cast<size_t>(_expanded_width * _expanded_height), 4));
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)_expanded_width, (GLsizei)_expanded_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, blank_buffer);
|
||||
free(blank_buffer);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter);
|
||||
|
@ -55,12 +55,12 @@ class Speaker {
|
||||
|
||||
void set_output_rate(float cycles_per_second, int buffer_size) {
|
||||
output_cycles_per_second_ = cycles_per_second;
|
||||
buffer_in_progress_.resize((size_t)buffer_size);
|
||||
buffer_in_progress_.resize(static_cast<size_t>(buffer_size));
|
||||
set_needs_updated_filter_coefficients();
|
||||
}
|
||||
|
||||
void set_output_quality(int number_of_taps) {
|
||||
requested_number_of_taps_ = (size_t)number_of_taps;
|
||||
requested_number_of_taps_ = static_cast<size_t>(number_of_taps);
|
||||
set_needs_updated_filter_coefficients();
|
||||
}
|
||||
|
||||
@ -150,10 +150,10 @@ template <class T> class Filter: public Speaker {
|
||||
// if input and output rates exactly match, just accumulate results and pass on
|
||||
if(input_cycles_per_second_ == output_cycles_per_second_ && high_frequency_cut_off_ < 0.0) {
|
||||
while(cycles_remaining) {
|
||||
unsigned int cycles_to_read = static_cast<unsigned int>(buffer_in_progress_.size() - (size_t)buffer_in_progress_pointer_);
|
||||
unsigned int cycles_to_read = static_cast<unsigned int>(buffer_in_progress_.size() - static_cast<size_t>(buffer_in_progress_pointer_));
|
||||
if(cycles_to_read > cycles_remaining) cycles_to_read = cycles_remaining;
|
||||
|
||||
static_cast<T *>(this)->get_samples(cycles_to_read, &buffer_in_progress_[(size_t)buffer_in_progress_pointer_]);
|
||||
static_cast<T *>(this)->get_samples(cycles_to_read, &buffer_in_progress_[static_cast<size_t>(buffer_in_progress_pointer_]));
|
||||
buffer_in_progress_pointer_ += cycles_to_read;
|
||||
|
||||
// announce to delegate if full
|
||||
@ -173,13 +173,13 @@ template <class T> class Filter: public Speaker {
|
||||
// if the output rate is less than the input rate, use the filter
|
||||
if(input_cycles_per_second_ > output_cycles_per_second_ || (input_cycles_per_second_ == output_cycles_per_second_ && high_frequency_cut_off_ >= 0.0)) {
|
||||
while(cycles_remaining) {
|
||||
unsigned int cycles_to_read = static_cast<unsigned int>(std::min((size_t)cycles_remaining, number_of_taps_ - input_buffer_depth_));
|
||||
static_cast<T *>(this)->get_samples(cycles_to_read, &input_buffer_[(size_t)input_buffer_depth_]);
|
||||
unsigned int cycles_to_read = static_cast<unsigned int>(std::min(static_cast<size_t>(cycles_remaining), number_of_taps_ - input_buffer_depth_));
|
||||
static_cast<T *>(this)->get_samples(cycles_to_read, &input_buffer_[static_cast<size_t>(input_buffer_depth_)]);
|
||||
cycles_remaining -= cycles_to_read;
|
||||
input_buffer_depth_ += cycles_to_read;
|
||||
|
||||
if(input_buffer_depth_ == number_of_taps_) {
|
||||
buffer_in_progress_[(size_t)buffer_in_progress_pointer_] = filter_->apply(input_buffer_.data());
|
||||
buffer_in_progress_[static_cast<size_t>(buffer_in_progress_pointer_)] = filter_->apply(input_buffer_.data());
|
||||
buffer_in_progress_pointer_++;
|
||||
|
||||
// announce to delegate if full
|
||||
@ -196,7 +196,7 @@ template <class T> class Filter: public Speaker {
|
||||
uint64_t steps = stepper_->step();
|
||||
if(steps < number_of_taps_) {
|
||||
int16_t *input_buffer = input_buffer_.data();
|
||||
memmove(input_buffer, &input_buffer[steps], sizeof(int16_t) * ((size_t)number_of_taps_ - (size_t)steps));
|
||||
memmove(input_buffer, &input_buffer[steps], sizeof(int16_t) * (static_cast<size_t>(number_of_taps_) - static_cast<size_t>(steps)));
|
||||
input_buffer_depth_ -= steps;
|
||||
} else {
|
||||
if(steps > number_of_taps_)
|
||||
@ -225,7 +225,7 @@ template <class T> class Filter: public Speaker {
|
||||
if(requested_number_of_taps_) {
|
||||
number_of_taps_ = requested_number_of_taps_;
|
||||
} else {
|
||||
number_of_taps_ = (size_t)ceilf((input_cycles_per_second_ + output_cycles_per_second_) / output_cycles_per_second_);
|
||||
number_of_taps_ = static_cast<size_t>(ceilf((input_cycles_per_second_ + output_cycles_per_second_) / output_cycles_per_second_));
|
||||
number_of_taps_ *= 2;
|
||||
number_of_taps_ |= 1;
|
||||
}
|
||||
@ -243,7 +243,7 @@ template <class T> class Filter: public Speaker {
|
||||
}
|
||||
filter_.reset(new SignalProcessing::FIRFilter(static_cast<unsigned int>(number_of_taps_), static_cast<float>(input_cycles_per_second_), 0.0, high_pass_frequency, SignalProcessing::FIRFilter::DefaultAttenuation));
|
||||
|
||||
input_buffer_.resize((size_t)number_of_taps_);
|
||||
input_buffer_.resize(static_cast<size_t>(number_of_taps_));
|
||||
input_buffer_depth_ = 0;
|
||||
}
|
||||
};
|
||||
|
@ -16,12 +16,12 @@ AllRAMProcessor::AllRAMProcessor(size_t memory_size) :
|
||||
timestamp_(0) {}
|
||||
|
||||
void AllRAMProcessor::set_data_at_address(uint16_t startAddress, size_t length, const uint8_t *data) {
|
||||
size_t endAddress = std::min(startAddress + length, (size_t)65536);
|
||||
size_t endAddress = std::min(startAddress + length, static_cast<size_t>(65536));
|
||||
memcpy(&memory_[startAddress], data, endAddress - startAddress);
|
||||
}
|
||||
|
||||
void AllRAMProcessor::get_data_at_address(uint16_t startAddress, size_t length, uint8_t *data) {
|
||||
size_t endAddress = std::min(startAddress + length, (size_t)65536);
|
||||
size_t endAddress = std::min(startAddress + length, static_cast<size_t>(65536));
|
||||
memcpy(data, &memory_[startAddress], endAddress - startAddress);
|
||||
}
|
||||
|
||||
|
@ -97,11 +97,11 @@ template < class T,
|
||||
scheduled_program_counter_ = current_instruction_page_->instructions[operation_ & halt_mask_];
|
||||
break;
|
||||
|
||||
case MicroOp::Increment16: (*(uint16_t *)operation->source)++; break;
|
||||
case MicroOp::IncrementPC: pc_.full += pc_increment_; break;
|
||||
case MicroOp::Decrement16: (*(uint16_t *)operation->source)--; break;
|
||||
case MicroOp::Move8: *(uint8_t *)operation->destination = *(uint8_t *)operation->source; break;
|
||||
case MicroOp::Move16: *(uint16_t *)operation->destination = *(uint16_t *)operation->source; break;
|
||||
case MicroOp::Increment16: (*static_cast<uint16_t *>(operation->source))++; break;
|
||||
case MicroOp::IncrementPC: pc_.full += pc_increment_; break;
|
||||
case MicroOp::Decrement16: (*static_cast<uint16_t *>(operation->source))--; break;
|
||||
case MicroOp::Move8: *static_cast<uint8_t *>(operation->destination) = *static_cast<uint8_t *>(operation->source); break;
|
||||
case MicroOp::Move16: *static_cast<uint16_t *>(operation->destination) = *static_cast<uint16_t *>(operation->source); break;
|
||||
|
||||
case MicroOp::AssembleAF:
|
||||
temp16_.bytes.high = a_;
|
||||
@ -122,17 +122,17 @@ template < class T,
|
||||
carry_result_ = 0;
|
||||
|
||||
case MicroOp::And:
|
||||
a_ &= *(uint8_t *)operation->source;
|
||||
a_ &= *static_cast<uint8_t *>(operation->source);
|
||||
set_logical_flags(Flag::HalfCarry);
|
||||
break;
|
||||
|
||||
case MicroOp::Or:
|
||||
a_ |= *(uint8_t *)operation->source;
|
||||
a_ |= *static_cast<uint8_t *>(operation->source);
|
||||
set_logical_flags(0);
|
||||
break;
|
||||
|
||||
case MicroOp::Xor:
|
||||
a_ ^= *(uint8_t *)operation->source;
|
||||
a_ ^= *static_cast<uint8_t *>(operation->source);
|
||||
set_logical_flags(0);
|
||||
break;
|
||||
|
||||
@ -183,7 +183,7 @@ template < class T,
|
||||
bit53_result_ = static_cast<uint8_t>(b53);
|
||||
|
||||
case MicroOp::CP8: {
|
||||
uint8_t value = *(uint8_t *)operation->source;
|
||||
uint8_t value = *static_cast<uint8_t *>(operation->source);
|
||||
int result = a_ - value;
|
||||
int half_result = (a_&0xf) - (value&0xf);
|
||||
|
||||
@ -196,7 +196,7 @@ template < class T,
|
||||
} break;
|
||||
|
||||
case MicroOp::SUB8: {
|
||||
uint8_t value = *(uint8_t *)operation->source;
|
||||
uint8_t value = *static_cast<uint8_t *>(operation->source);
|
||||
int result = a_ - value;
|
||||
int half_result = (a_&0xf) - (value&0xf);
|
||||
|
||||
@ -209,7 +209,7 @@ template < class T,
|
||||
} break;
|
||||
|
||||
case MicroOp::SBC8: {
|
||||
uint8_t value = *(uint8_t *)operation->source;
|
||||
uint8_t value = *static_cast<uint8_t *>(operation->source);
|
||||
int result = a_ - value - (carry_result_ & Flag::Carry);
|
||||
int half_result = (a_&0xf) - (value&0xf) - (carry_result_ & Flag::Carry);
|
||||
|
||||
@ -222,7 +222,7 @@ template < class T,
|
||||
} break;
|
||||
|
||||
case MicroOp::ADD8: {
|
||||
uint8_t value = *(uint8_t *)operation->source;
|
||||
uint8_t value = *static_cast<uint8_t *>(operation->source);
|
||||
int result = a_ + value;
|
||||
int half_result = (a_&0xf) + (value&0xf);
|
||||
|
||||
@ -235,7 +235,7 @@ template < class T,
|
||||
} break;
|
||||
|
||||
case MicroOp::ADC8: {
|
||||
uint8_t value = *(uint8_t *)operation->source;
|
||||
uint8_t value = *static_cast<uint8_t *>(operation->source);
|
||||
int result = a_ + value + (carry_result_ & Flag::Carry);
|
||||
int half_result = (a_&0xf) + (value&0xf) + (carry_result_ & Flag::Carry);
|
||||
|
||||
@ -263,7 +263,7 @@ template < class T,
|
||||
} break;
|
||||
|
||||
case MicroOp::Increment8: {
|
||||
uint8_t value = *(uint8_t *)operation->source;
|
||||
uint8_t value = *static_cast<uint8_t *>(operation->source);
|
||||
int result = value + 1;
|
||||
|
||||
// with an increment, overflow occurs if the sign changes from
|
||||
@ -271,7 +271,7 @@ template < class T,
|
||||
int overflow = (value ^ result) & ~value;
|
||||
int half_result = (value&0xf) + 1;
|
||||
|
||||
*(uint8_t *)operation->source = static_cast<uint8_t>(result);
|
||||
*static_cast<uint8_t *>(operation->source) = static_cast<uint8_t>(result);
|
||||
|
||||
// sign, zero and 5 & 3 are set directly from the result
|
||||
bit53_result_ = sign_result_ = zero_result_ = static_cast<uint8_t>(result);
|
||||
@ -281,7 +281,7 @@ template < class T,
|
||||
} break;
|
||||
|
||||
case MicroOp::Decrement8: {
|
||||
uint8_t value = *(uint8_t *)operation->source;
|
||||
uint8_t value = *static_cast<uint8_t *>(operation->source);
|
||||
int result = value - 1;
|
||||
|
||||
// with a decrement, overflow occurs if the sign changes from
|
||||
@ -289,7 +289,7 @@ template < class T,
|
||||
int overflow = (value ^ result) & value;
|
||||
int half_result = (value&0xf) - 1;
|
||||
|
||||
*(uint8_t *)operation->source = static_cast<uint8_t>(result);
|
||||
*static_cast<uint8_t *>(operation->source) = static_cast<uint8_t>(result);
|
||||
|
||||
// sign, zero and 5 & 3 are set directly from the result
|
||||
bit53_result_ = sign_result_ = zero_result_ = static_cast<uint8_t>(result);
|
||||
@ -356,8 +356,8 @@ template < class T,
|
||||
#pragma mark - 16-bit arithmetic
|
||||
|
||||
case MicroOp::ADD16: {
|
||||
memptr_.full = *(uint16_t *)operation->destination;
|
||||
uint16_t sourceValue = *(uint16_t *)operation->source;
|
||||
memptr_.full = *static_cast<uint16_t *>(operation->destination);
|
||||
uint16_t sourceValue = *static_cast<uint16_t *>(operation->source);
|
||||
uint16_t destinationValue = memptr_.full;
|
||||
int result = sourceValue + destinationValue;
|
||||
int halfResult = (sourceValue&0xfff) + (destinationValue&0xfff);
|
||||
@ -367,13 +367,13 @@ template < class T,
|
||||
half_carry_result_ = static_cast<uint8_t>(halfResult >> 8);
|
||||
subtract_flag_ = 0;
|
||||
|
||||
*(uint16_t *)operation->destination = static_cast<uint16_t>(result);
|
||||
*static_cast<uint16_t *>(operation->destination) = static_cast<uint16_t>(result);
|
||||
memptr_.full++;
|
||||
} break;
|
||||
|
||||
case MicroOp::ADC16: {
|
||||
memptr_.full = *(uint16_t *)operation->destination;
|
||||
uint16_t sourceValue = *(uint16_t *)operation->source;
|
||||
memptr_.full = *static_cast<uint16_t *>(operation->destination);
|
||||
uint16_t sourceValue = *static_cast<uint16_t *>(operation->source);
|
||||
uint16_t destinationValue = memptr_.full;
|
||||
int result = sourceValue + destinationValue + (carry_result_ & Flag::Carry);
|
||||
int halfResult = (sourceValue&0xfff) + (destinationValue&0xfff) + (carry_result_ & Flag::Carry);
|
||||
@ -388,13 +388,13 @@ template < class T,
|
||||
half_carry_result_ = static_cast<uint8_t>(halfResult >> 8);
|
||||
parity_overflow_result_ = static_cast<uint8_t>(overflow >> 13);
|
||||
|
||||
*(uint16_t *)operation->destination = static_cast<uint16_t>(result);
|
||||
*static_cast<uint16_t *>(operation->destination) = static_cast<uint16_t>(result);
|
||||
memptr_.full++;
|
||||
} break;
|
||||
|
||||
case MicroOp::SBC16: {
|
||||
memptr_.full = *(uint16_t *)operation->destination;
|
||||
uint16_t sourceValue = *(uint16_t *)operation->source;
|
||||
memptr_.full = *static_cast<uint16_t *>(operation->destination);
|
||||
uint16_t sourceValue = *static_cast<uint16_t *>(operation->source);
|
||||
uint16_t destinationValue = memptr_.full;
|
||||
int result = destinationValue - sourceValue - (carry_result_ & Flag::Carry);
|
||||
int halfResult = (destinationValue&0xfff) - (sourceValue&0xfff) - (carry_result_ & Flag::Carry);
|
||||
@ -412,7 +412,7 @@ template < class T,
|
||||
half_carry_result_ = static_cast<uint8_t>(halfResult >> 8);
|
||||
parity_overflow_result_ = static_cast<uint8_t>(overflow >> 13);
|
||||
|
||||
*(uint16_t *)operation->destination = static_cast<uint16_t>(result);
|
||||
*static_cast<uint16_t *>(operation->destination) = static_cast<uint16_t>(result);
|
||||
memptr_.full++;
|
||||
} break;
|
||||
|
||||
@ -619,12 +619,12 @@ template < class T,
|
||||
#pragma mark - Bit Manipulation
|
||||
|
||||
case MicroOp::BIT: {
|
||||
uint8_t result = *(uint8_t *)operation->source & (1 << ((operation_ >> 3)&7));
|
||||
uint8_t result = *static_cast<uint8_t *>(operation->source) & (1 << ((operation_ >> 3)&7));
|
||||
|
||||
if(current_instruction_page_->is_indexed || ((operation_&0x08) == 7)) {
|
||||
bit53_result_ = memptr_.bytes.high;
|
||||
} else {
|
||||
bit53_result_ = *(uint8_t *)operation->source;
|
||||
bit53_result_ = *static_cast<uint8_t *>(operation->source);
|
||||
}
|
||||
|
||||
sign_result_ = zero_result_ = result;
|
||||
@ -634,11 +634,11 @@ template < class T,
|
||||
} break;
|
||||
|
||||
case MicroOp::RES:
|
||||
*(uint8_t *)operation->source &= ~(1 << ((operation_ >> 3)&7));
|
||||
*static_cast<uint8_t *>(operation->source) &= ~(1 << ((operation_ >> 3)&7));
|
||||
break;
|
||||
|
||||
case MicroOp::SET:
|
||||
*(uint8_t *)operation->source |= (1 << ((operation_ >> 3)&7));
|
||||
*static_cast<uint8_t *>(operation->source) |= (1 << ((operation_ >> 3)&7));
|
||||
break;
|
||||
|
||||
#pragma mark - Rotation and shifting
|
||||
@ -675,58 +675,58 @@ template < class T,
|
||||
#undef set_rotate_flags
|
||||
|
||||
#define set_shift_flags() \
|
||||
sign_result_ = zero_result_ = bit53_result_ = *(uint8_t *)operation->source; \
|
||||
sign_result_ = zero_result_ = bit53_result_ = *static_cast<uint8_t *>(operation->source); \
|
||||
set_parity(sign_result_); \
|
||||
half_carry_result_ = 0; \
|
||||
subtract_flag_ = 0;
|
||||
|
||||
case MicroOp::RLC:
|
||||
carry_result_ = *(uint8_t *)operation->source >> 7;
|
||||
*(uint8_t *)operation->source = static_cast<uint8_t>((*(uint8_t *)operation->source << 1) | carry_result_);
|
||||
carry_result_ = *static_cast<uint8_t *>(operation->source) >> 7;
|
||||
*static_cast<uint8_t *>(operation->source) = static_cast<uint8_t>((*static_cast<uint8_t *>(operation->source) << 1) | carry_result_);
|
||||
set_shift_flags();
|
||||
break;
|
||||
|
||||
case MicroOp::RRC:
|
||||
carry_result_ = *(uint8_t *)operation->source;
|
||||
*(uint8_t *)operation->source = static_cast<uint8_t>((*(uint8_t *)operation->source >> 1) | (carry_result_ << 7));
|
||||
carry_result_ = *static_cast<uint8_t *>(operation->source);
|
||||
*static_cast<uint8_t *>(operation->source) = static_cast<uint8_t>((*static_cast<uint8_t *>(operation->source) >> 1) | (carry_result_ << 7));
|
||||
set_shift_flags();
|
||||
break;
|
||||
|
||||
case MicroOp::RL: {
|
||||
uint8_t next_carry = *(uint8_t *)operation->source >> 7;
|
||||
*(uint8_t *)operation->source = static_cast<uint8_t>((*(uint8_t *)operation->source << 1) | (carry_result_ & Flag::Carry));
|
||||
uint8_t next_carry = *static_cast<uint8_t *>(operation->source) >> 7;
|
||||
*static_cast<uint8_t *>(operation->source) = static_cast<uint8_t>((*static_cast<uint8_t *>(operation->source) << 1) | (carry_result_ & Flag::Carry));
|
||||
carry_result_ = next_carry;
|
||||
set_shift_flags();
|
||||
} break;
|
||||
|
||||
case MicroOp::RR: {
|
||||
uint8_t next_carry = *(uint8_t *)operation->source;
|
||||
*(uint8_t *)operation->source = static_cast<uint8_t>((*(uint8_t *)operation->source >> 1) | (carry_result_ << 7));
|
||||
uint8_t next_carry = *static_cast<uint8_t *>(operation->source);
|
||||
*static_cast<uint8_t *>(operation->source) = static_cast<uint8_t>((*static_cast<uint8_t *>(operation->source) >> 1) | (carry_result_ << 7));
|
||||
carry_result_ = next_carry;
|
||||
set_shift_flags();
|
||||
} break;
|
||||
|
||||
case MicroOp::SLA:
|
||||
carry_result_ = *(uint8_t *)operation->source >> 7;
|
||||
*(uint8_t *)operation->source = static_cast<uint8_t>(*(uint8_t *)operation->source << 1);
|
||||
carry_result_ = *static_cast<uint8_t *>(operation->source) >> 7;
|
||||
*static_cast<uint8_t *>(operation->source) = static_cast<uint8_t>(*static_cast<uint8_t *>(operation->source) << 1);
|
||||
set_shift_flags();
|
||||
break;
|
||||
|
||||
case MicroOp::SRA:
|
||||
carry_result_ = *(uint8_t *)operation->source;
|
||||
*(uint8_t *)operation->source = static_cast<uint8_t>((*(uint8_t *)operation->source >> 1) | (*(uint8_t *)operation->source & 0x80));
|
||||
carry_result_ = *static_cast<uint8_t *>(operation->source);
|
||||
*static_cast<uint8_t *>(operation->source) = static_cast<uint8_t>((*static_cast<uint8_t *>(operation->source) >> 1) | (*static_cast<uint8_t *>(operation->source) & 0x80));
|
||||
set_shift_flags();
|
||||
break;
|
||||
|
||||
case MicroOp::SLL:
|
||||
carry_result_ = *(uint8_t *)operation->source >> 7;
|
||||
*(uint8_t *)operation->source = static_cast<uint8_t>(*(uint8_t *)operation->source << 1) | 1;
|
||||
carry_result_ = *static_cast<uint8_t *>(operation->source) >> 7;
|
||||
*static_cast<uint8_t *>(operation->source) = static_cast<uint8_t>(*static_cast<uint8_t *>(operation->source) << 1) | 1;
|
||||
set_shift_flags();
|
||||
break;
|
||||
|
||||
case MicroOp::SRL:
|
||||
carry_result_ = *(uint8_t *)operation->source;
|
||||
*(uint8_t *)operation->source = static_cast<uint8_t>((*(uint8_t *)operation->source >> 1));
|
||||
carry_result_ = *static_cast<uint8_t *>(operation->source);
|
||||
*static_cast<uint8_t *>(operation->source) = static_cast<uint8_t>((*static_cast<uint8_t *>(operation->source) >> 1));
|
||||
set_shift_flags();
|
||||
break;
|
||||
|
||||
@ -782,7 +782,7 @@ template < class T,
|
||||
|
||||
case MicroOp::SetInFlags:
|
||||
subtract_flag_ = half_carry_result_ = 0;
|
||||
sign_result_ = zero_result_ = bit53_result_ = *(uint8_t *)operation->source;
|
||||
sign_result_ = zero_result_ = bit53_result_ = *static_cast<uint8_t *>(operation->source);
|
||||
set_parity(sign_result_);
|
||||
break;
|
||||
|
||||
@ -845,7 +845,7 @@ template < class T,
|
||||
break;
|
||||
|
||||
case MicroOp::CalculateIndexAddress:
|
||||
memptr_.full = static_cast<uint16_t>(*(uint16_t *)operation->source + (int8_t)temp8_);
|
||||
memptr_.full = static_cast<uint16_t>(*static_cast<uint16_t *>(operation->source) + (int8_t)temp8_);
|
||||
break;
|
||||
|
||||
case MicroOp::IndexedPlaceHolder:
|
||||
|
@ -51,9 +51,9 @@ std::unique_ptr<Catalogue> StaticAnalyser::Acorn::GetDFSCatalogue(const std::sha
|
||||
new_file.execution_address = (uint32_t)(details->data[file_offset+2] | (details->data[file_offset+3] << 8) | ((details->data[file_offset+6]&0xc0) << 10));
|
||||
new_file.is_protected = !!(names->data[file_offset + 7] & 0x80);
|
||||
|
||||
long data_length = (long)(details->data[file_offset+4] | (details->data[file_offset+5] << 8) | ((details->data[file_offset+6]&0x30) << 12));
|
||||
long data_length = static_cast<long>(details->data[file_offset+4] | (details->data[file_offset+5] << 8) | ((details->data[file_offset+6]&0x30) << 12));
|
||||
int start_sector = details->data[file_offset+7] | ((details->data[file_offset+6]&0x03) << 8);
|
||||
new_file.data.reserve((size_t)data_length);
|
||||
new_file.data.reserve(static_cast<size_t>(data_length));
|
||||
|
||||
if(start_sector < 2) continue;
|
||||
while(data_length > 0) {
|
||||
|
@ -24,7 +24,7 @@ static void DeterminePagingFor2kCartridge(StaticAnalyser::Target &target, const
|
||||
|
||||
std::function<size_t(uint16_t address)> high_location_mapper = [](uint16_t address) {
|
||||
address &= 0x1fff;
|
||||
return (size_t)(address - 0x1800);
|
||||
return static_cast<size_t>(address - 0x1800);
|
||||
};
|
||||
StaticAnalyser::MOS6502::Disassembly high_location_disassembly =
|
||||
StaticAnalyser::MOS6502::Disassemble(segment.data, high_location_mapper, {entry_address, break_address});
|
||||
@ -126,8 +126,8 @@ static void DeterminePagingForCartridge(StaticAnalyser::Target &target, const St
|
||||
break_address = static_cast<uint16_t>(segment.data[segment.data.size() - 2] | (segment.data[segment.data.size() - 1] << 8));
|
||||
|
||||
std::function<size_t(uint16_t address)> address_mapper = [](uint16_t address) {
|
||||
if(!(address & 0x1000)) return (size_t)-1;
|
||||
return (size_t)(address & 0xfff);
|
||||
if(!(address & 0x1000)) return static_cast<size_t>(-1);
|
||||
return static_cast<size_t>(address & 0xfff);
|
||||
};
|
||||
|
||||
std::vector<uint8_t> final_4k(segment.data.end() - 4096, segment.data.end());
|
||||
|
@ -188,7 +188,7 @@ std::list<File> StaticAnalyser::Commodore::GetFiles(const std::shared_ptr<Storag
|
||||
}
|
||||
|
||||
// parse directory
|
||||
size_t header_pointer = (size_t)-32;
|
||||
size_t header_pointer = static_cast<size_t>(-32);
|
||||
while(header_pointer+32+31 < directory.size()) {
|
||||
header_pointer += 32;
|
||||
|
||||
@ -212,7 +212,7 @@ std::list<File> StaticAnalyser::Commodore::GetFiles(const std::shared_ptr<Storag
|
||||
}
|
||||
new_file.name = Storage::Data::Commodore::petscii_from_bytes(&new_file.raw_name[0], 16, false);
|
||||
|
||||
size_t number_of_sectors = (size_t)directory[header_pointer + 0x1e] + ((size_t)directory[header_pointer + 0x1f] << 8);
|
||||
size_t number_of_sectors = static_cast<size_t>(directory[header_pointer + 0x1e]) + (static_cast<size_t>(directory[header_pointer + 0x1f]) << 8);
|
||||
new_file.data.reserve((number_of_sectors - 1) * 254 + 252);
|
||||
|
||||
bool is_first_sector = true;
|
||||
|
@ -332,6 +332,6 @@ Disassembly StaticAnalyser::MOS6502::Disassemble(const std::vector<uint8_t> &mem
|
||||
|
||||
std::function<size_t(uint16_t)> StaticAnalyser::MOS6502::OffsetMapper(uint16_t start_address) {
|
||||
return [start_address](uint16_t argument) {
|
||||
return (size_t)(argument - start_address);
|
||||
return static_cast<size_t>(argument - start_address);
|
||||
};
|
||||
}
|
||||
|
@ -21,9 +21,9 @@ BinaryDump::BinaryDump(const char *file_name) {
|
||||
// grab contents
|
||||
FILE *file = fopen(file_name, "rb");
|
||||
if(!file) throw ErrorNotAccessible;
|
||||
size_t data_length = (size_t)file_stats.st_size;
|
||||
size_t data_length = static_cast<size_t>(file_stats.st_size);
|
||||
std::vector<uint8_t> contents(data_length);
|
||||
fread(&contents[0], 1, (size_t)(data_length), file);
|
||||
fread(&contents[0], 1, static_cast<size_t>(data_length), file);
|
||||
fclose(file);
|
||||
|
||||
// enshrine
|
||||
|
@ -28,11 +28,11 @@ PRG::PRG(const char *file_name) {
|
||||
int loading_address = fgetc(file);
|
||||
loading_address |= fgetc(file) << 8;
|
||||
|
||||
size_t data_length = (size_t)file_stats.st_size - 2;
|
||||
size_t data_length = static_cast<size_t>(file_stats.st_size) - 2;
|
||||
size_t padded_data_length = 1;
|
||||
while(padded_data_length < data_length) padded_data_length <<= 1;
|
||||
std::vector<uint8_t> contents(padded_data_length);
|
||||
fread(&contents[0], 1, (size_t)(data_length), file);
|
||||
fread(&contents[0], 1, static_cast<size_t>(data_length), file);
|
||||
fclose(file);
|
||||
|
||||
// accept only files intended to load at 0xa000
|
||||
|
@ -20,8 +20,8 @@ using namespace Storage::Disk;
|
||||
AcornADF::AcornADF(const char *file_name) : MFMSectorDump(file_name) {
|
||||
// very loose validation: the file needs to be a multiple of 256 bytes
|
||||
// and not ungainly large
|
||||
if(file_stats_.st_size % (off_t)(128 << sector_size)) throw ErrorNotAcornADF;
|
||||
if(file_stats_.st_size < 7 * (off_t)(128 << sector_size)) throw ErrorNotAcornADF;
|
||||
if(file_stats_.st_size % static_cast<off_t>(128 << sector_size)) throw ErrorNotAcornADF;
|
||||
if(file_stats_.st_size < 7 * static_cast<off_t>(128 << sector_size)) throw ErrorNotAcornADF;
|
||||
|
||||
// check that the initial directory's 'Hugo's are present
|
||||
fseek(file_, 513, SEEK_SET);
|
||||
|
@ -30,7 +30,7 @@ CPCDSK::CPCDSK(const char *file_name) :
|
||||
// Skip two unused bytes and grab the track size table.
|
||||
fseek(file_, 2, SEEK_CUR);
|
||||
for(int c = 0; c < head_position_count_ * head_count_; c++) {
|
||||
track_sizes_.push_back((size_t)(fgetc(file_) << 8));
|
||||
track_sizes_.push_back(static_cast<size_t>(fgetc(file_) << 8));
|
||||
}
|
||||
} else {
|
||||
size_of_a_track_ = fgetc16le();
|
||||
@ -118,7 +118,7 @@ std::shared_ptr<Track> CPCDSK::get_track_at_position(Track::Address address) {
|
||||
if(is_extended_) {
|
||||
data_size = sector_info.actual_length;
|
||||
} else {
|
||||
data_size = (size_t)(128 << sector_info.length);
|
||||
data_size = static_cast<size_t>(128 << sector_info.length);
|
||||
if(data_size == 0x2000) data_size = 0x1800;
|
||||
}
|
||||
new_sector.data.resize(data_size);
|
||||
|
@ -84,7 +84,7 @@ std::shared_ptr<Track> D64::get_track_at_position(Track::Address address) {
|
||||
// = 349 GCR bytes per sector
|
||||
|
||||
PCMSegment track;
|
||||
size_t track_bytes = 349 * (size_t)sectors_by_zone[zone];
|
||||
size_t track_bytes = 349 * static_cast<size_t>(sectors_by_zone[zone]);
|
||||
track.number_of_bits = static_cast<unsigned int>(track_bytes) * 8;
|
||||
track.data.resize(track_bytes);
|
||||
uint8_t *data = &track.data[0];
|
||||
|
@ -43,7 +43,7 @@ std::shared_ptr<Track> G64::get_track_at_position(Track::Address address) {
|
||||
if(address.head >= 1) return resulting_track;
|
||||
|
||||
// seek to this track's entry in the track table
|
||||
fseek(file_, (long)((address.position * 4) + 0xc), SEEK_SET);
|
||||
fseek(file_, static_cast<long>((address.position * 4) + 0xc), SEEK_SET);
|
||||
|
||||
// read the track offset
|
||||
uint32_t track_offset;
|
||||
@ -64,7 +64,7 @@ std::shared_ptr<Track> G64::get_track_at_position(Track::Address address) {
|
||||
fread(&track_contents[0], 1, track_length, file_);
|
||||
|
||||
// seek to this track's entry in the speed zone table
|
||||
fseek(file_, (long)((address.position * 4) + 0x15c), SEEK_SET);
|
||||
fseek(file_, static_cast<long>((address.position * 4) + 0x15c), SEEK_SET);
|
||||
|
||||
// read the speed zone offsrt
|
||||
uint32_t speed_zone_offset;
|
||||
|
@ -23,7 +23,7 @@ HFE::HFE(const char *file_name) :
|
||||
head_count_ = fgetc(file_);
|
||||
|
||||
fseek(file_, 7, SEEK_CUR);
|
||||
track_list_offset_ = (long)fgetc16le() << 9;
|
||||
track_list_offset_ = static_cast<long>(fgetc16le() << 9);
|
||||
}
|
||||
|
||||
HFE::~HFE() {
|
||||
@ -49,7 +49,7 @@ uint16_t HFE::seek_track(Track::Address address) {
|
||||
// based on an assumption of two heads.
|
||||
fseek(file_, track_list_offset_ + address.position * 4, SEEK_SET);
|
||||
|
||||
long track_offset = (long)fgetc16le() << 9;
|
||||
long track_offset = static_cast<long>(fgetc16le() << 9);
|
||||
uint16_t track_length = fgetc16le();
|
||||
|
||||
fseek(file_, track_offset, SEEK_SET);
|
||||
|
@ -158,7 +158,7 @@ void OricMFMDSK::set_tracks(const std::map<Track::Address, std::shared_ptr<Track
|
||||
|
||||
std::lock_guard<std::mutex> lock_guard(file_access_mutex_);
|
||||
fseek(file_, file_offset, SEEK_SET);
|
||||
size_t track_size = std::min((size_t)6400, parsed_track.size());
|
||||
size_t track_size = std::min(static_cast<size_t>(6400), parsed_track.size());
|
||||
fwrite(parsed_track.data(), 1, track_size, file_);
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ using namespace Storage::Disk;
|
||||
std::shared_ptr<Track> Storage::Disk::track_for_sectors(uint8_t *const source, uint8_t track, uint8_t side, uint8_t first_sector, uint8_t size, bool is_double_density) {
|
||||
std::vector<Storage::Encodings::MFM::Sector> sectors;
|
||||
|
||||
off_t byte_size = (off_t)(128 << size);
|
||||
off_t byte_size = static_cast<off_t>(128 << size);
|
||||
off_t source_pointer = 0;
|
||||
for(int sector = 0; sector < 10; sector++) {
|
||||
sectors.emplace_back();
|
||||
@ -48,7 +48,7 @@ void Storage::Disk::decode_sectors(Track &track, uint8_t *const destination, uin
|
||||
Storage::Disk::track_serialisation(track, is_double_density ? Storage::Encodings::MFM::MFMBitLength : Storage::Encodings::MFM::FMBitLength),
|
||||
is_double_density);
|
||||
|
||||
size_t byte_size = (size_t)(128 << sector_size);
|
||||
size_t byte_size = static_cast<size_t>(128 << sector_size);
|
||||
for(auto &pair : sectors) {
|
||||
if(pair.second.address.sector > last_sector) continue;
|
||||
if(pair.second.address.sector < first_sector) continue;
|
||||
|
@ -161,7 +161,7 @@ template<class T> std::shared_ptr<Storage::Disk::Track>
|
||||
shifter.add_data_address_mark();
|
||||
|
||||
size_t c = 0;
|
||||
size_t declared_length = (size_t)(128 << sector.size);
|
||||
size_t declared_length = static_cast<size_t>(128 << sector.size);
|
||||
for(c = 0; c < sector.data.size() && c < declared_length; c++) {
|
||||
shifter.add_byte(sector.data[c]);
|
||||
}
|
||||
@ -200,7 +200,7 @@ void Encoder::add_crc(bool incorrectly) {
|
||||
add_byte((crc_value & 0xff) ^ (incorrectly ? 1 : 0));
|
||||
}
|
||||
|
||||
const size_t Storage::Encodings::MFM::DefaultSectorGapLength = (size_t)~0;
|
||||
const size_t Storage::Encodings::MFM::DefaultSectorGapLength = std::numeric_limits<size_t>::max();
|
||||
|
||||
std::shared_ptr<Storage::Disk::Track> Storage::Encodings::MFM::GetFMTrackWithSectors(const std::vector<Sector> §ors, size_t sector_gap_length, uint8_t sector_gap_filler_byte) {
|
||||
return GetTrackWithSectors<FMEncoder>(
|
||||
|
@ -56,7 +56,7 @@ std::map<size_t, Storage::Encodings::MFM::Sector> Storage::Encodings::MFM::secto
|
||||
case 2: new_sector->address.sector = shifter.get_byte(); ++position; break;
|
||||
case 3:
|
||||
new_sector->size = shifter.get_byte();
|
||||
size = (size_t)(128 << new_sector->size);
|
||||
size = static_cast<size_t>(128 << new_sector->size);
|
||||
++position;
|
||||
is_reading = false;
|
||||
shifter.set_should_obey_syncs(true);
|
||||
|
@ -40,7 +40,7 @@ std::unique_ptr<Storage::Disk::CPM::Catalogue> Storage::Disk::CPM::GetCatalogue(
|
||||
sector = 0;
|
||||
track++;
|
||||
}
|
||||
} while(size_read < (size_t)parameters.block_size);
|
||||
} while(size_read < static_cast<size_t>(parameters.block_size));
|
||||
}
|
||||
|
||||
catalogue_allocation_bitmap <<= 1;
|
||||
@ -77,7 +77,7 @@ std::unique_ptr<Storage::Disk::CPM::Catalogue> Storage::Disk::CPM::GetCatalogue(
|
||||
for(size_t s = 0; s < 3; s++) entry.type.push_back((char)catalogue[c + s + 9] & 0x7f);
|
||||
entry.read_only = catalogue[c + 9] & 0x80;
|
||||
entry.system = catalogue[c + 10] & 0x80;
|
||||
entry.extent = (size_t)(catalogue[c + 12] + (catalogue[c + 14] << 5));
|
||||
entry.extent = static_cast<size_t>(catalogue[c + 12] + (catalogue[c + 14] << 5));
|
||||
entry.number_of_records = catalogue[c + 15];
|
||||
entry.catalogue_index = c;
|
||||
}
|
||||
@ -88,7 +88,7 @@ std::unique_ptr<Storage::Disk::CPM::Catalogue> Storage::Disk::CPM::GetCatalogue(
|
||||
std::unique_ptr<Catalogue> result(new Catalogue);
|
||||
|
||||
bool has_long_allocation_units = (parameters.tracks * parameters.sectors_per_track * static_cast<int>(sector_size) / parameters.block_size) >= 256;
|
||||
size_t bytes_per_catalogue_entry = (has_long_allocation_units ? 8 : 16) * (size_t)parameters.block_size;
|
||||
size_t bytes_per_catalogue_entry = (has_long_allocation_units ? 8 : 16) * static_cast<size_t>(parameters.block_size);
|
||||
int sectors_per_block = parameters.block_size / static_cast<int>(sector_size);
|
||||
int records_per_sector = static_cast<int>(sector_size) / 128;
|
||||
|
||||
@ -111,7 +111,7 @@ std::unique_ptr<Storage::Disk::CPM::Catalogue> Storage::Disk::CPM::GetCatalogue(
|
||||
new_file.system = entry->system;
|
||||
|
||||
// Create storage for data.
|
||||
size_t required_size = final_entry->extent * bytes_per_catalogue_entry + (size_t)final_entry->number_of_records * 128;
|
||||
size_t required_size = final_entry->extent * bytes_per_catalogue_entry + static_cast<size_t>(final_entry->number_of_records) * 128;
|
||||
new_file.data.resize(required_size);
|
||||
|
||||
// Accumulate all data.
|
||||
@ -144,7 +144,7 @@ std::unique_ptr<Storage::Disk::CPM::Catalogue> Storage::Disk::CPM::GetCatalogue(
|
||||
}
|
||||
|
||||
int records_to_copy = std::min(entry->number_of_records - record, records_per_sector);
|
||||
memcpy(&new_file.data[entry->extent * bytes_per_catalogue_entry + (size_t)record * 128], sector_contents->data.data(), (size_t)records_to_copy * 128);
|
||||
memcpy(&new_file.data[entry->extent * bytes_per_catalogue_entry + static_cast<size_t>(record) * 128], sector_contents->data.data(), static_cast<size_t>(records_to_copy) * 128);
|
||||
record += records_to_copy;
|
||||
}
|
||||
}
|
||||
|
@ -85,9 +85,9 @@ void FileHolder::ensure_file_is_at_least_length(long length) {
|
||||
fseek(file_, 0, SEEK_END);
|
||||
long bytes_to_write = length - ftell(file_);
|
||||
if(bytes_to_write > 0) {
|
||||
uint8_t *empty = new uint8_t[(size_t)bytes_to_write];
|
||||
memset(empty, 0, (size_t)bytes_to_write);
|
||||
fwrite(empty, sizeof(uint8_t), (size_t)bytes_to_write, file_);
|
||||
uint8_t *empty = new uint8_t[static_cast<size_t>(bytes_to_write)];
|
||||
memset(empty, 0, static_cast<size_t>(bytes_to_write));
|
||||
fwrite(empty, sizeof(uint8_t), static_cast<size_t>(bytes_to_write), file_);
|
||||
delete[] empty;
|
||||
}
|
||||
}
|
||||
|
@ -62,10 +62,10 @@ CSW::CSW(const char *file_name) :
|
||||
// The only clue given by CSW as to the output size in bytes is that there will be
|
||||
// number_of_waves waves. Waves are usually one byte, but may be five. So this code
|
||||
// is pessimistic.
|
||||
source_data_.resize((size_t)number_of_waves * 5);
|
||||
source_data_.resize(static_cast<size_t>(number_of_waves) * 5);
|
||||
|
||||
std::vector<uint8_t> file_data;
|
||||
size_t remaining_data = (size_t)file_stats_.st_size - (size_t)ftell(file_);
|
||||
size_t remaining_data = static_cast<size_t>(file_stats_.st_size) - static_cast<size_t>(ftell(file_));
|
||||
file_data.resize(remaining_data);
|
||||
fread(file_data.data(), sizeof(uint8_t), remaining_data, file_);
|
||||
|
||||
@ -74,7 +74,7 @@ CSW::CSW(const char *file_name) :
|
||||
// needed.
|
||||
uLongf output_length = static_cast<uLongf>(number_of_waves * 5);
|
||||
uncompress(source_data_.data(), &output_length, file_data.data(), file_data.size());
|
||||
source_data_.resize((size_t)output_length);
|
||||
source_data_.resize(static_cast<size_t>(output_length));
|
||||
} else {
|
||||
rle_start_ = ftell(file_);
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ void TZX::get_next_pulses() {
|
||||
|
||||
void TZX::get_generalised_data_block() {
|
||||
uint32_t block_length = fgetc32le();
|
||||
long endpoint = ftell(file_) + (long)block_length;
|
||||
long endpoint = ftell(file_) + static_cast<long>(block_length);
|
||||
uint16_t pause_after_block = fgetc16le();
|
||||
|
||||
uint32_t total_pilot_symbols = fgetc32le();
|
||||
@ -200,7 +200,7 @@ void TZX::get_turbo_speed_data_block() {
|
||||
data_block.data.number_of_bits_in_final_byte = static_cast<uint8_t>(fgetc(file_));
|
||||
data_block.data.pause_after_block = fgetc16le();
|
||||
data_block.data.data_length = fgetc16le();
|
||||
data_block.data.data_length |= (long)(fgetc(file_) << 16);
|
||||
data_block.data.data_length |= static_cast<long>(fgetc(file_) << 16);
|
||||
|
||||
get_data_block(data_block);
|
||||
}
|
||||
@ -251,7 +251,7 @@ void TZX::get_pure_data_block() {
|
||||
data.number_of_bits_in_final_byte = static_cast<uint8_t>(fgetc(file_));
|
||||
data.pause_after_block = fgetc16le();
|
||||
data.data_length = fgetc16le();
|
||||
data.data_length |= (long)(fgetc(file_) << 16);
|
||||
data.data_length |= static_cast<long>(fgetc(file_) << 16);
|
||||
|
||||
get_data(data);
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ void UEF::queue_implicit_bit_pattern(uint32_t length) {
|
||||
}
|
||||
|
||||
void UEF::queue_explicit_bit_pattern(uint32_t length) {
|
||||
size_t length_in_bits = (length << 3) - (size_t)gzget8(file_);
|
||||
size_t length_in_bits = (length << 3) - static_cast<size_t>(gzget8(file_));
|
||||
uint8_t current_byte = 0;
|
||||
for(size_t bit = 0; bit < length_in_bits; bit++) {
|
||||
if(!(bit&7)) current_byte = gzget8(file_);
|
||||
|
@ -15,8 +15,8 @@ ZX80O81P::ZX80O81P(const char *file_name) :
|
||||
Storage::FileHolder(file_name) {
|
||||
|
||||
// Grab the actual file contents
|
||||
data_.resize((size_t)file_stats_.st_size);
|
||||
fread(data_.data(), 1, (size_t)file_stats_.st_size, file_);
|
||||
data_.resize(static_cast<size_t>(file_stats_.st_size));
|
||||
fread(data_.data(), 1, static_cast<size_t>(file_stats_.st_size), file_);
|
||||
|
||||
// If it's a ZX81 file, prepend a file name.
|
||||
std::string type = extension();
|
||||
|
Loading…
x
Reference in New Issue
Block a user