Why not use math?

factor = 1024 * 8 / scrp->fbFormat.bitsPerPixel;
if (mode->HDisplay * mode->VDisplay > scrp->videoRam * factor)
  return MODE_MEM;
  
This assumes that scrp->fbFormat.bitsPerPixel is a power of two.

Also, really huge monochrome displays are still vunerable.  In
other words, I would also use a 64bit number.

-Gryn

On Tue, Nov 05, 2002 at 01:09:14AM +0100, Alexander Stohr wrote:
> Hmm, looks like a limitation of the inital coders knowledge.
> Nothing to worry about in an OpenSource project where lots
> of coding youngsters did take part in.
> 
> The below coding:
> 
>   if (mode->HDisplay * mode->VDisplay * scrp->fbFormat.bitsPerPixel 
>     > scrp->videoRam * (1024 * 8))
>         return MODE_MEM;
_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert

Reply via email to