Re: For RDS: peeking and poking WORDs

new topic     » goto parent     » topic index » view thread      » older message » newer message

David Guy writes:
> Any chance of adding routines to poke & peek WORDs in
> additions to the ones to poke/peek BYTEs and DWORDs.

I'm not really inclined to add peek2()/poke2(), since
reading/writing 2 bytes at a time isn't nearly as common
on 32-bit machines, as reading/writing 1 or 4 bytes.
You can easily make your own peek2/poke2, and you will
only suffer if they are critical to performance.

> In addition, some Windows structures, BMPINFOHEADER
> for instance, have WORD sized elements.

It would not be a performance problem, if you
are just reading a few words from the header of a bitmap file.

> poke( pBIH + BIH_biBitCount, {wordVal, floor(wordVal/256)})

floor(a/b) is pretty efficient - it just does a single integer divide
at the machine level - the floor operation is optimized out.

I'm not sure if it's faster to poke (or peek) a sequence of
2 elements, as you have done, or do two separate pokes.

Regards,
     Rob Craig
     Rapid Deployment Software
     http://members.aol.com/FilesEu/

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu