mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-09 21:40:08 +00:00
38 lines
804 B
C
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
|