mirror of
https://github.com/ksherlock/profuse.git
synced 2025-01-10 07:30:09 +00:00
git-svn-id: https://profuse.googlecode.com/svn/branches/v2@193 aa027e90-d47c-11dd-86d7-074df07e0730
This commit is contained in:
parent
ae52676bf2
commit
616411809b
@ -57,34 +57,34 @@ namespace LittleEndian {
|
|||||||
namespace BigEndian {
|
namespace BigEndian {
|
||||||
|
|
||||||
|
|
||||||
inline uint16_t Read16(const void *vp)
|
uint16_t Read16(const void *vp)
|
||||||
{
|
{
|
||||||
const uint8_t *p = (const uint8_t *)vp;
|
const uint8_t *p = (const uint8_t *)vp;
|
||||||
return (p[0] << 8) | (p[1]);
|
return (p[0] << 8) | (p[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint32_t Read24(const void *vp)
|
uint32_t Read24(const void *vp)
|
||||||
{
|
{
|
||||||
const uint8_t *p = (const uint8_t *)vp;
|
const uint8_t *p = (const uint8_t *)vp;
|
||||||
return (p[0] << 16) | (p[1] << 8) | (p[2]);
|
return (p[0] << 16) | (p[1] << 8) | (p[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline uint32_t Read32(const void *vp)
|
uint32_t Read32(const void *vp)
|
||||||
{
|
{
|
||||||
const uint8_t *p = (const uint8_t *)vp;
|
const uint8_t *p = (const uint8_t *)vp;
|
||||||
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3]);
|
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void Write16(void *vp, uint16_t x)
|
void Write16(void *vp, uint16_t x)
|
||||||
{
|
{
|
||||||
uint8_t *p = (uint8_t *)vp;
|
uint8_t *p = (uint8_t *)vp;
|
||||||
p[0] = (x >> 8) & 0xff;
|
p[0] = (x >> 8) & 0xff;
|
||||||
p[1] = (x) & 0xff;
|
p[1] = (x) & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Write24(void *vp, uint32_t x)
|
void Write24(void *vp, uint32_t x)
|
||||||
{
|
{
|
||||||
uint8_t *p = (uint8_t *)vp;
|
uint8_t *p = (uint8_t *)vp;
|
||||||
p[0] = (x >> 16) & 0xff;
|
p[0] = (x >> 16) & 0xff;
|
||||||
@ -92,7 +92,7 @@ namespace BigEndian {
|
|||||||
p[2] = (x) & 0xff;
|
p[2] = (x) & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Write32(void *vp, uint32_t x)
|
void Write32(void *vp, uint32_t x)
|
||||||
{
|
{
|
||||||
uint8_t *p = (uint8_t *)vp;
|
uint8_t *p = (uint8_t *)vp;
|
||||||
p[0] = (x >> 24) & 0xff;
|
p[0] = (x >> 24) & 0xff;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user