[GRASS5] src/libes/gis/ new function G_is_little_endian()
Markus Neteler
neteler at geog.uni-hannover.de
Mon Jan 15 17:13:51 EST 2001
Radim,
On Mon, Jan 15, 2001 at 07:15:36PM +0100, Radim Blazek wrote:
> 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.
Sounds good to me. If you would like to change that in
src/libes/gis/endian.c
then I will update the related modules. I wasn't aware of
/usr/include/endian.h, sorry.
> 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.
fine.
> 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_)
Yes, that's important. We need an agreement here (hi software engineers)
Markus
----------------------------------------
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