chore: remove magic numbers

This commit is contained in:
2022-04-13 21:39:35 -03:00
parent ffbb31c767
commit dfe94fb931
6 changed files with 17 additions and 29 deletions

View File

@@ -413,13 +413,14 @@ pub const Ppu = struct {
};
const Palette = struct {
const palram_size = 0x400;
const Self = @This();
buf: []u8,
alloc: Allocator,
fn init(alloc: Allocator) !Self {
const buf = try alloc.alloc(u8, 0x400);
const buf = try alloc.alloc(u8, palram_size);
std.mem.set(u8, buf, 0);
return Self{
@@ -474,13 +475,14 @@ const Palette = struct {
};
const Vram = struct {
const vram_size = 0x18000;
const Self = @This();
buf: []u8,
alloc: Allocator,
fn init(alloc: Allocator) !Self {
const buf = try alloc.alloc(u8, 0x18000);
const buf = try alloc.alloc(u8, vram_size);
std.mem.set(u8, buf, 0);
return Self{
@@ -543,13 +545,14 @@ const Vram = struct {
};
const Oam = struct {
const oam_size = 0x400;
const Self = @This();
buf: []u8,
alloc: Allocator,
fn init(alloc: Allocator) !Self {
const buf = try alloc.alloc(u8, 0x400);
const buf = try alloc.alloc(u8, oam_size);
std.mem.set(u8, buf, 0);
return Self{