Index: [thread] [date] [subject] [author]
  From: Andrew Apted <ajapted@netspace.net.au>
  To  : ggi-develop@eskimo.com
  Date: Mon, 17 May 1999 12:40:01 +1000

Re: Semi-Snag in PyGGI...

Andy writes:

>  > So is there no way to do it without some sort of switch() on display
>  > depth?
>  
>  Maybe one should explain, why it is bad to make something like
>  
>  char *ptr;
>  ptr+=increment
>  *(int *)ptr=something
>  
>  There are two main implications you should be aware of:
>  
>  1. You will overflow the buffer by (sizeof(accessed-size)-sizeof(inc_size)).
>  That's a minor issue, as you can just alloc it a little bigger.
>  
>  2. Non-Intel architectures will often have _heavy_ penalties for unaligned
>  access. Thus doing 32-bit wide accesses at increments of 1 byte will cause
>  3 such accesses per one aligned access.
>  Some architectures will sefgault/sigbus right away, while others will try
>  to compensate. On the Alpha for example, it will lead to an exception
>  that will then analyze the code that caused the fault and emulate it.
>  It will crawl.

3. Many architectures are big-endian, and trying to handle the 3
bytes-per-pixel mode like that just won't work (in this case the pixels
_have_ to be written 1 byte at a time).

Cheers,
___________________________________________________
                                               \  /
  Andrew Apted   <ajapted@netspace.net.au>      \/
 

Index: [thread] [date] [subject] [author]