Hi,

Micha Nelissen wrote:

function evk_malloc (size: longword): pointer;
const
  ALIGNMENT = 16;
var
  ptr: pointer;
begin
  ptr := getmem(size + ALIGNMENT);
  result := Align (ptr, ALIGNMENT);
  if result = ptr then
      pbyte(result) += 16;

Why not use ALIGNMENT here also?

Hah, I got stuck between using a constant and direct value... :) I should make it consistent. Thanks for reviewing and pointing this out.

BTW, GetMem already returns 16 byte aligned blocks. If it does not, it's
considered a bug.

I didn't know that, looks like I should reread the documentation. I need the address on which the block begins to be divisible with 16, though.

David

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to