aseprite/src/base/24bits.h
David Capello 16da2512b4 Remove dependency with Allegro library in config.h file
* Created base::write24bits() function (and detect endianness with a
  special base/config.h.cmakein)
* Use _WIN32 instead of ALLEGRO_WINDOWS
* Use _DEBUG instead of DEBUGMODE
* Replaced AL_CONST with "const" in bmp_format.cpp
* Replace stricmp() with base::utf8_icmp()
2015-02-12 10:55:58 -03:00

38 lines
804 B
C++

// Aseprite Base Library
// Copyright (c) 2001-2015 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef BASE_24BITS_H_INCLUDED
#define BASE_24BITS_H_INCLUDED
#pragma once
#include "base/config.h"
namespace base {
#ifdef ASEPRITE_LITTLE_ENDIAN
template<typename PTR, typename VALUE>
inline void write24bits(PTR* ptr, VALUE value) {
((uint8_t*)ptr)[0] = value;
((uint8_t*)ptr)[1] = value >> 8;
((uint8_t*)ptr)[2] = value >> 16;
}
#elif defined(ASEPRITE_BIG_ENDIAN)
template<typename PTR, typename VALUE>
inline void write24bits(PTR* ptr, VALUE value) {
((uint8_t*)ptr)[0] = value >> 16;
((uint8_t*)ptr)[1] = value >> 8;
((uint8_t*)ptr)[2] = value;
}
#endif
} // namespace base
#endif