[gimp-dds] / tags / release-2.0.3 / endian.h Repository:
ViewVC logotype

View of /tags/release-2.0.3/endian.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 102 - (download) (as text) (annotate)
Fri Apr 11 18:08:24 2008 UTC (19 months, 1 week ago) by cocidius
File size: 2123 byte(s)
Release 2.0.3 tag
    1 /*
    2    DDS GIMP plugin
    3 
    4    Copyright (C) 2004-2008 Shawn Kirst <skirst@insightbb.com>,
    5    with parts (C) 2003 Arne Reuter <homepage@arnereuter.de> where specified.
    6 
    7    This program is free software; you can redistribute it and/or
    8    modify it under the terms of the GNU General Public
    9    License as published by the Free Software Foundation; either
   10    version 2 of the License, or (at your option) any later version.
   11 
   12    This program is distributed in the hope that it will be useful,
   13    but WITHOUT ANY WARRANTY; without even the implied warranty of
   14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   15    General Public License for more details.
   16 
   17    You should have received a copy of the GNU General Public License
   18    along with this program; see the file COPYING.  If not, write to
   19    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   20    Boston, MA 02111-1307, USA.
   21 */
   22 
   23 #ifndef ENDIAN_H
   24 #define ENDIAN_H
   25 
   26 #define GETL64(buf) \
   27    (((unsigned long long)(buf)[0]      ) | \
   28     ((unsigned long long)(buf)[1] <<  8) | \
   29     ((unsigned long long)(buf)[2] << 16) | \
   30     ((unsigned long long)(buf)[3] << 24) | \
   31     ((unsigned long long)(buf)[4] << 32) | \
   32     ((unsigned long long)(buf)[5] << 40) | \
   33     ((unsigned long long)(buf)[6] << 48) | \
   34     ((unsigned long long)(buf)[7] << 56))
   35 
   36 #define GETL32(buf) \
   37    (((unsigned int)(buf)[0]      ) | \
   38     ((unsigned int)(buf)[1] <<  8) | \
   39     ((unsigned int)(buf)[2] << 16) | \
   40     ((unsigned int)(buf)[3] << 24))
   41 
   42 #define GETL16(buf) \
   43    (((unsigned short)(buf)[0]     ) | \
   44     ((unsigned short)(buf)[1] << 8))
   45 
   46 #define CHAR32(c0, c1, c2, c3) \
   47          ((unsigned int)(((c0) & 0xff)      ) | \
   48                         (((c1) & 0xff) <<  8) | \
   49                         (((c2) & 0xff) << 16) | \
   50                         (((c3) & 0xff) << 24))
   51 
   52 #define PUTL16(buf, s) \
   53    (buf)[0] = ((s)     ) & 0xff; \
   54    (buf)[1] = ((s) >> 8) & 0xff;
   55 
   56 #define PUTL32(buf, l) \
   57    (buf)[0] = ((l)      ) & 0xff; \
   58    (buf)[1] = ((l) >>  8) & 0xff; \
   59    (buf)[2] = ((l) >> 16) & 0xff; \
   60    (buf)[3] = ((l) >> 24) & 0xff;
   61 
   62 #endif

ViewVC Help
Powered by ViewVC 1.0.4