delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/05/22:07:43

Sender: nate AT cartsys DOT com
Message-ID: <361979EC.B55399B2@cartsys.com>
Date: Mon, 05 Oct 1998 19:01:16 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.0.35 i486)
MIME-Version: 1.0
To: Omar Hawk <omarhawk AT t-online DOT de>
CC: djgpp AT delorie DOT com
Subject: Re: allocating dword aligned memory with __dpmi_allocate_memory
References: <6v8ag4$922$1 AT news02 DOT btx DOT dtag DOT de>
Reply-To: djgpp AT delorie DOT com

Omar Hawk wrote:
> 
> Hello there,
> 
> I want to write an assembler function that copies mem using the string
> instructions MOVSD & MOVSW. I'd like to use MOVSD to store 2 words a
> time. How can I allocate DWORD ALIGNED memory using
> __dpmi_allocate_memory? This would be very helpful if one is using a
> 16bit vesa mode: I hope to double the speed by a factor of 2.

Why can't you just use `malloc'?  The memory block it returns will be at
least dword aligned.  (If you don't trust it, you could always do:

  void *p = malloc(size + 3);
  p = (void *)((((unsigned long)p)+3)&~4);

)
-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019