flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Borsuc
Fill it with what?
EDIT: by "quad words" you mean "english words with 4 characters" or "quadwords" ("word" is 16-bits number)? |
|||
![]() |
|
tthsqe
quad word = 64 bit integer
The look up table should look like [starting address ] = 0xFFFFFFFFFFFFFFFF [starting address + 8] = 0xFFFFFFFFFFFFFFFF [starting address +16] = 0xFFFFFFFFFFFFFFFF ... [starting address + bignum*8] I don't want the program to have a chance of overwriting anything that happens to be at these latter addresses. |
|||
![]() |
|
tthsqe
I think I got it:
table db 1000 dup (0,0,0,0,0,0,0,0) Will this set aside 1000 8-byte memory locations for table? Is there a better way to do this to allow for faster lookup times? |
|||
![]() |
|
sinsi
Code: table rq 1000 |
|||
![]() |
|
tthsqe
hm...
Code: table dq 1000 Code: table dq 1000 dup 0 |
|||
![]() |
|
sinsi
"rq", not "dq" - reserve quadword(s)
|
|||
![]() |
|
Borsuc
I'm confused. You said you wanted 0xFFFFFFFFFFFFFFFF, not 0, so why use dup(0) in your examples? Use dup(-1) instead.
|
|||
![]() |
|
bitRAKE
Code: table rq .size .size = 1000 . . macro table.init { lea rdi,[table] mov ecx,table.size or rax,-1 rep stosq } Code: lea rdi,[table] mov ecx,table.size * 8 mov al,-1 rep stosb |
|||
![]() |
|
tthsqe
Quote:
don't be confused. The intial contents of the table is irrelevent - it is initialized by the program and then used as a lookup table. |
|||
![]() |
|
tthsqe
If the start of the table is not a address that is a multiple of 8 (or 4?), will there be a penalty for misaligned memory accesses? Is there a way to fix this in fasm? The values are looked up in a performance sensitive loop.
|
|||
![]() |
|
LocoDelAssembly
If the memory access crosses a cache line boundary you'll get a penalty (not sure what about a misaligned access that doesn't crosses a line on newer processors). Since some elements in the table will obviously cross a cache line (and probably a page boundary too), it is better to align always.
Well, if what you want is a LUT of quad words then this is the way Code: align 8 ; Perhaps could be better to use 16, 32, or 64 (the latter is the cache line size of an Athlon64) LUT rq LUT_SIZE_IN_QWORDS |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.