Test Circular Buffer

This commit is contained in:
jaby 2022-12-23 20:33:36 +01:00
parent 4d6c701a22
commit 791fe85ab8
3 changed files with 12 additions and 1 deletions

View File

@ -11,6 +11,14 @@ namespace JabyEngine {
constexpr ArrayRange() = default;
constexpr ArrayRange(T* start, size_t size) : start(start), size(size) {
}
constexpr T& operator[](size_t idx) {
return this->start[idx];
}
constexpr const T& operator[](size_t idx) const {
return this->start[idx];
}
};
}

View File

@ -17,7 +17,7 @@ namespace JabyEngine {
public:
FastCircularBuffer() = default;
void setup(T* buffer_start_adr, size_t element_count) {
void setup(T* buffer_start_adr) {
this->start_adr = buffer_start_adr;
this->read_idx = 0;
this->write_idx = 0;

View File

@ -50,6 +50,7 @@ pub fn write(output: &mut Output, overlay_desc: &OverlayDesc) -> Result<(), Erro
writeln!(output, "\tOVERLAY {} : NOCROSSREFS SUBALIGN(4) {{", get_slot_start_adr(slot))?;
write_section(output, &slot.sections, false)?;
writeln!(output, "\t}}")?;
writeln!(output, "\t. = ALIGN(4);")?;
writeln!(output, "\t__{}_end = .;", slot.name)?;
writeln!(output, "")?;
}
@ -88,6 +89,7 @@ fn write_planschi_section(output: &mut Output, boot_overlay: &BootOverlaySection
writeln!(output, "\t\t\t*libJabyEngine.a:*_boot.o(*)")?;
writeln!(output, "\t\t\t*_boot.o(*)")?;
writeln!(output, "")?;
writeln!(output, "\t\t\t. = ALIGN(4);")?;
writeln!(output, "\t\t\t__boot_loader_end = .;")?;
writeln!(output, "\t\t\t/*Only needed for the PSX BIOS to load the entire game*/")?;
writeln!(output, "\t\t\t. = ALIGN(2048);")?;
@ -97,6 +99,7 @@ fn write_planschi_section(output: &mut Output, boot_overlay: &BootOverlaySection
writeln!(output, "\t\t/*{}*/", boot_overlay.name)?;
write_section(output, &boot_overlay.sections, true)?;
writeln!(output, "\t}}")?;
writeln!(output, "\t. = ALIGN(4);")?;
writeln!(output, "\t__{}_end = .;", boot_overlay.name)?;
writeln!(output, "")?;