[GRASS5] src/libes/gis/ new function G_is_little_endian()

Radim Blazek Radim.Blazek at dhv.cz
Mon Jan 15 13:15:36 EST 2001


Markus Neteler wrote:
> Hi all,
> 
> as it is used in various places in GRASS, I have added
> G_is_little_endian() function to test little/big endianess
> in
> src/libes/gis/endian.c
> (GISLIB)
> 
>  *****************************************************************
>  * endian test
>  *
>  * G_is_little_endian ()
>  *
>  * Test if machine is little or big endian (required for file coding)
>  *
>  * Returns: 1 little endian
>  *          0 big endian
> 
> I have updated to src/libes/ogsf/ accordingly (NVIZ is affected).
> Seems to work well.
> 
> Maybe this test is useful for the new vect-lib?

At least in theory third 'PDP'(3412) byte order exists.
I have defined in new include/vect/dig_vect.h
#define ENDIAN_LITTLE 0                                                             
#define ENDIAN_BIG    1                                                             
#define ENDIAN_OTHER  2
(LITTLE_ENDIAN, ... is already used in /usr/include/endian.h)
If you have written that function we could move that definition
into gis.h. Maybe G_get_byte_order() would be better. 

In new vect lib test_port program exists which is compiled and run
during compilation and writes out new header file where byte order 
is defined (for each type). That is useful because you can use
#if BYTE_ORDER == ENDIAN_LITTLE
and speed is increased.

We should probably add before (new) constants defined in grass
some prefix (GR_, GRASS_) to be sure that conflicts cannot appear?
(As used in other libes: G_, TK_, SQL_)

Radim
 



---------------------------------------- 
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'



More information about the grass-dev mailing list