Browse Source

Use Mile.Mobility.Portable.Types definitions in Mile.Helpers.Portable.Base.Unstaged.

pull/617/head
MouriNaruto 4 months ago
parent
commit
7fe5320710
  1. 84
      NanaZip.Codecs/Mile.Helpers.Portable.Base.Unstaged.cpp
  2. 28
      NanaZip.Codecs/Mile.Helpers.Portable.Base.Unstaged.h

84
NanaZip.Codecs/Mile.Helpers.Portable.Base.Unstaged.cpp

@ -10,80 +10,80 @@
#include "Mile.Helpers.Portable.Base.Unstaged.h"
EXTERN_C uint8_t MileReadUInt8(
EXTERN_C MO_UINT8 MileReadUInt8(
_In_ const void* BaseAddress)
{
const uint8_t* Base = reinterpret_cast<const uint8_t*>(BaseAddress);
const MO_UINT8* Base = reinterpret_cast<const MO_UINT8*>(BaseAddress);
return Base[0];
}
EXTERN_C uint16_t MileReadUInt16BigEndian(
EXTERN_C MO_UINT16 MileReadUInt16BigEndian(
_In_ const void* BaseAddress)
{
const uint8_t* Base = reinterpret_cast<const uint8_t*>(BaseAddress);
const MO_UINT8* Base = reinterpret_cast<const MO_UINT8*>(BaseAddress);
return
(static_cast<uint16_t>(Base[0]) << 8) |
(static_cast<uint16_t>(Base[1]));
(static_cast<MO_UINT16>(Base[0]) << 8) |
(static_cast<MO_UINT16>(Base[1]));
}
EXTERN_C uint16_t MileReadUInt16LittleEndian(
EXTERN_C MO_UINT16 MileReadUInt16LittleEndian(
_In_ const void* BaseAddress)
{
const uint8_t* Base = reinterpret_cast<const uint8_t*>(BaseAddress);
const MO_UINT8* Base = reinterpret_cast<const MO_UINT8*>(BaseAddress);
return
(static_cast<uint16_t>(Base[0])) |
(static_cast<uint16_t>(Base[1]) << 8);
(static_cast<MO_UINT16>(Base[0])) |
(static_cast<MO_UINT16>(Base[1]) << 8);
}
EXTERN_C uint32_t MileReadUInt32BigEndian(
EXTERN_C MO_UINT32 MileReadUInt32BigEndian(
_In_ const void* BaseAddress)
{
const uint8_t* Base = reinterpret_cast<const uint8_t*>(BaseAddress);
const MO_UINT8* Base = reinterpret_cast<const MO_UINT8*>(BaseAddress);
return
(static_cast<uint32_t>(Base[0]) << 24) |
(static_cast<uint32_t>(Base[1]) << 16) |
(static_cast<uint32_t>(Base[2]) << 8) |
(static_cast<uint32_t>(Base[3]));
(static_cast<MO_UINT32>(Base[0]) << 24) |
(static_cast<MO_UINT32>(Base[1]) << 16) |
(static_cast<MO_UINT32>(Base[2]) << 8) |
(static_cast<MO_UINT32>(Base[3]));
}
EXTERN_C uint32_t MileReadUInt32LittleEndian(
EXTERN_C MO_UINT32 MileReadUInt32LittleEndian(
_In_ const void* BaseAddress)
{
const uint8_t* Base = reinterpret_cast<const uint8_t*>(BaseAddress);
const MO_UINT8* Base = reinterpret_cast<const MO_UINT8*>(BaseAddress);
return
(static_cast<uint32_t>(Base[0])) |
(static_cast<uint32_t>(Base[1]) << 8) |
(static_cast<uint32_t>(Base[2]) << 16) |
(static_cast<uint32_t>(Base[3]) << 24);
(static_cast<MO_UINT32>(Base[0])) |
(static_cast<MO_UINT32>(Base[1]) << 8) |
(static_cast<MO_UINT32>(Base[2]) << 16) |
(static_cast<MO_UINT32>(Base[3]) << 24);
}
EXTERN_C uint64_t MileReadUInt64BigEndian(
EXTERN_C MO_UINT64 MileReadUInt64BigEndian(
_In_ const void* BaseAddress)
{
const uint8_t* Base = reinterpret_cast<const uint8_t*>(BaseAddress);
const MO_UINT8* Base = reinterpret_cast<const MO_UINT8*>(BaseAddress);
return
(static_cast<uint64_t>(Base[0]) << 56) |
(static_cast<uint64_t>(Base[1]) << 48) |
(static_cast<uint64_t>(Base[2]) << 40) |
(static_cast<uint64_t>(Base[3]) << 32) |
(static_cast<uint64_t>(Base[4]) << 24) |
(static_cast<uint64_t>(Base[5]) << 16) |
(static_cast<uint64_t>(Base[6]) << 8) |
(static_cast<uint64_t>(Base[7]));
(static_cast<MO_UINT64>(Base[0]) << 56) |
(static_cast<MO_UINT64>(Base[1]) << 48) |
(static_cast<MO_UINT64>(Base[2]) << 40) |
(static_cast<MO_UINT64>(Base[3]) << 32) |
(static_cast<MO_UINT64>(Base[4]) << 24) |
(static_cast<MO_UINT64>(Base[5]) << 16) |
(static_cast<MO_UINT64>(Base[6]) << 8) |
(static_cast<MO_UINT64>(Base[7]));
}
EXTERN_C uint64_t MileReadUInt64LittleEndian(
EXTERN_C MO_UINT64 MileReadUInt64LittleEndian(
_In_ const void* BaseAddress)
{
const uint8_t* Base = reinterpret_cast<const uint8_t*>(BaseAddress);
const MO_UINT8* Base = reinterpret_cast<const MO_UINT8*>(BaseAddress);
return
(static_cast<uint64_t>(Base[0])) |
(static_cast<uint64_t>(Base[1]) << 8) |
(static_cast<uint64_t>(Base[2]) << 16) |
(static_cast<uint64_t>(Base[3]) << 24) |
(static_cast<uint64_t>(Base[4]) << 32) |
(static_cast<uint64_t>(Base[5]) << 40) |
(static_cast<uint64_t>(Base[6]) << 48) |
(static_cast<uint64_t>(Base[7]) << 56);
(static_cast<MO_UINT64>(Base[0])) |
(static_cast<MO_UINT64>(Base[1]) << 8) |
(static_cast<MO_UINT64>(Base[2]) << 16) |
(static_cast<MO_UINT64>(Base[3]) << 24) |
(static_cast<MO_UINT64>(Base[4]) << 32) |
(static_cast<MO_UINT64>(Base[5]) << 40) |
(static_cast<MO_UINT64>(Base[6]) << 48) |
(static_cast<MO_UINT64>(Base[7]) << 56);
}

28
NanaZip.Codecs/Mile.Helpers.Portable.Base.Unstaged.h

@ -11,19 +11,9 @@
#ifndef MILE_PORTABLE_HELPERS_BASE_UNSTAGED
#define MILE_PORTABLE_HELPERS_BASE_UNSTAGED
#include <stdint.h>
#ifndef EXTERN_C
#ifdef __cplusplus
#define EXTERN_C extern "C"
#else
#define EXTERN_C extern
#endif
#endif // !EXTERN_C
#include <Mile.Mobility.Portable.Types.h>
#ifndef _In_
#define _In_
#endif // !_In_
#include <stdint.h>
/**
* @brief Reads an unsigned 8-bit integer from the specified memory address.
@ -32,7 +22,7 @@
* readable memory.
* @return The unsigned 8-bit integer value.
*/
EXTERN_C uint8_t MileReadUInt8(
EXTERN_C MO_UINT8 MileReadUInt8(
_In_ const void* BaseAddress);
/**
@ -43,7 +33,7 @@ EXTERN_C uint8_t MileReadUInt8(
* readable memory.
* @return The unsigned 16-bit integer value.
*/
EXTERN_C uint16_t MileReadUInt16BigEndian(
EXTERN_C MO_UINT16 MileReadUInt16BigEndian(
_In_ const void* BaseAddress);
/**
@ -54,7 +44,7 @@ EXTERN_C uint16_t MileReadUInt16BigEndian(
* readable memory.
* @return The unsigned 16-bit integer value.
*/
EXTERN_C uint16_t MileReadUInt16LittleEndian(
EXTERN_C MO_UINT16 MileReadUInt16LittleEndian(
_In_ const void* BaseAddress);
/**
@ -65,7 +55,7 @@ EXTERN_C uint16_t MileReadUInt16LittleEndian(
* readable memory.
* @return The unsigned 32-bit integer value.
*/
EXTERN_C uint32_t MileReadUInt32BigEndian(
EXTERN_C MO_UINT32 MileReadUInt32BigEndian(
_In_ const void* BaseAddress);
/**
@ -76,7 +66,7 @@ EXTERN_C uint32_t MileReadUInt32BigEndian(
* readable memory.
* @return The unsigned 32-bit integer value.
*/
EXTERN_C uint32_t MileReadUInt32LittleEndian(
EXTERN_C MO_UINT32 MileReadUInt32LittleEndian(
_In_ const void* BaseAddress);
/**
@ -87,7 +77,7 @@ EXTERN_C uint32_t MileReadUInt32LittleEndian(
* readable memory.
* @return The unsigned 64-bit integer value.
*/
EXTERN_C uint64_t MileReadUInt64BigEndian(
EXTERN_C MO_UINT64 MileReadUInt64BigEndian(
_In_ const void* BaseAddress);
/**
@ -98,7 +88,7 @@ EXTERN_C uint64_t MileReadUInt64BigEndian(
* readable memory.
* @return The unsigned 64-bit integer value.
*/
EXTERN_C uint64_t MileReadUInt64LittleEndian(
EXTERN_C MO_UINT64 MileReadUInt64LittleEndian(
_In_ const void* BaseAddress);
#endif // !MILE_PORTABLE_HELPERS_BASE_UNSTAGED
Loading…
Cancel
Save