flat assembler
Message board for the users of flat assembler.
Index
> MenuetOS > align? |
Author |
|
bitRAKE 24 Feb 2008, 17:53
the macro reserves bytes (rb) to insure the current offset is divisible by value. If we look at the case of "align 4":
Code: $ | $-3 3-# 0 | 3 0 1 | 0 3 2 | 1 2 3 | 2 1 Alignment can result in a speed improvement. Here is a macro that does alignment plus an offset: Code: macro ALIGN val,off { rb (val+off-($ mod val))mod val } _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
24 Feb 2008, 17:53 |
|
edfed 24 Feb 2008, 18:15
the align is cause of hardware
the memory is on 64 bits bus so, to access a data, the need of aligned addresses on this bus is good. if you want to access a dword at [5], you should read the first part, three bytes at [5,6,7], and the second part at [8] so, it consumme one extra memory cycle to read unaligned values. align is not exclusive to menuet and x86. it is valid for real documents accesing. a good example are the dragon ball episodes. to follow the story, you need to watch at least two consecutives episodes. as episodes are unaligned on the story sequence, it is boring... that's why we try to make aligned DBZ episodes. |
|||
24 Feb 2008, 18:15 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.