digama0 / mm0

Metamath Zero specification language
Creative Commons Zero v1.0 Universal
312 stars 40 forks source link

Question about parser.c #106

Closed MirceaS closed 2 years ago

MirceaS commented 2 years ago

https://github.com/digama0/mm0/blob/6391620f1e0c4878586b95e9badc127bd63258eb/mm0-c/parser.c#L15

Shouldn't this line also use (size)/4 like line 18, since it's also the size in bytes rather than words?

Also, on the same note, shouldn't this be doing ceiling integer division rather that floor integer division, or are we guaranteed to always get sizes multiples of 4?

digama0 commented 2 years ago

Yes, the bounds check should also use (size)/4. The allocations are all supposed to be 4 byte aligned (since they have u32's in them), but I added some manual padding to make sure.