2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2002-10-12 11:37:38 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2008-04-16 22:40:48 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup imbuf
|
2011-02-27 20:23:21 +00:00
|
|
|
*/
|
|
|
|
|
2020-08-07 09:50:34 +02:00
|
|
|
#pragma once
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2020-03-19 09:33:03 +01:00
|
|
|
#include <stdio.h>
|
2002-10-12 11:37:38 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#ifndef WIN32
|
2011-09-19 06:32:19 +00:00
|
|
|
# include <unistd.h>
|
2002-10-12 11:37:38 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <math.h>
|
2020-03-19 09:33:03 +01:00
|
|
|
#include <string.h>
|
|
|
|
#include <sys/stat.h>
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#ifndef WIN32
|
2011-09-19 06:32:19 +00:00
|
|
|
# include <sys/mman.h>
|
|
|
|
# define O_BINARY 0
|
2002-10-12 11:37:38 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define SWAP_SHORT(x) (((x & 0xff) << 8) | ((x >> 8) & 0xff))
|
2019-04-17 06:17:24 +02:00
|
|
|
#define SWAP_LONG(x) \
|
|
|
|
(((x) << 24) | (((x)&0xff00) << 8) | (((x) >> 8) & 0xff00) | (((x) >> 24) & 0xff))
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#define ENDIAN_NOP(x) (x)
|
|
|
|
|
2011-09-19 08:02:17 +00:00
|
|
|
#ifdef __BIG_ENDIAN__
|
2011-09-19 06:32:19 +00:00
|
|
|
# define LITTLE_SHORT SWAP_SHORT
|
|
|
|
# define LITTLE_LONG SWAP_LONG
|
|
|
|
# define BIG_SHORT ENDIAN_NOP
|
|
|
|
# define BIG_LONG ENDIAN_NOP
|
2002-10-12 11:37:38 +00:00
|
|
|
#else
|
2011-09-19 06:32:19 +00:00
|
|
|
# define LITTLE_SHORT ENDIAN_NOP
|
|
|
|
# define LITTLE_LONG ENDIAN_NOP
|
|
|
|
# define BIG_SHORT SWAP_SHORT
|
|
|
|
# define BIG_LONG SWAP_LONG
|
2002-10-12 11:37:38 +00:00
|
|
|
#endif
|
|
|
|
|
2012-06-27 19:28:44 +00:00
|
|
|
#define IMB_DPI_DEFAULT 72.0f
|