This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: munmap slowness; IsBadReadPtr considered harmful


On Tue, 24 Feb 2004, Brian Ford wrote:

> On Tue, 24 Feb 2004, Brian Ford wrote:
>
> >   for (end = (char *)addr + len, addr = (void *)((DWORD)addr % getpagesize());
> >
> Doh!  Scratch that.  Obvious bug.
>
> Something more like:
>        addr = (void *)((DWORD)addr & getpagesize () - 1);
>
> I'll repost the final version when I actually have this tested well.
> Sorry!
>
It's too late in the day and my brain is turned off.  I'm an idiot, I
know.

Make that:

addr = (void *)((DWORD)addr & ~(getpagesize () - 1));

Thanks.

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax:   314-551-8444


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]