mirror of
https://github.com/libAthena/athena.git
synced 2025-12-16 00:17:05 +00:00
further updates to atdna
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "IStreamReader.hpp"
|
||||
#include "IStreamWriter.hpp"
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
namespace Athena
|
||||
{
|
||||
@@ -17,19 +18,24 @@ namespace io
|
||||
* Athena bundles a build-tool called 'atdna'. This tool functions
|
||||
* just like the 'clang' compiler, except it emits
|
||||
*/
|
||||
template <Endian DNAE = InheritEndian>
|
||||
template <Endian DNAE>
|
||||
struct DNA
|
||||
{
|
||||
template <typename T, Endian VE = DNAE>
|
||||
using Value = T;
|
||||
|
||||
template <typename T, Endian VE = DNAE>
|
||||
template <typename T, size_t cntVar, Endian VE = DNAE>
|
||||
using Vector = std::vector<T>;
|
||||
|
||||
virtual void read(IStreamReader&)=0;
|
||||
virtual void write(IStreamWriter&) const=0;
|
||||
};
|
||||
|
||||
/** Macro to automatically declare read/write methods in subclasses */
|
||||
#define DECL_DNA \
|
||||
void read(Athena::io::IStreamReader&); \
|
||||
void write(Athena::io::IStreamWriter&) const; \
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,6 @@ enum SeekOrigin
|
||||
|
||||
enum Endian
|
||||
{
|
||||
InheritEndian=0,
|
||||
LittleEndian,
|
||||
BigEndian
|
||||
};
|
||||
|
||||
@@ -56,6 +56,34 @@ typedef unsigned long atUint32;
|
||||
typedef signed long long atInt64;
|
||||
typedef unsigned long long atUint64;
|
||||
|
||||
// Vector types
|
||||
#if __SSE__
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
|
||||
typedef union
|
||||
{
|
||||
#if __clang__
|
||||
float clangVec __attribute__((__vector_size__(12)));
|
||||
#endif
|
||||
#if __SSE__
|
||||
__m128 mVec128;
|
||||
#endif
|
||||
float vec[3];
|
||||
} atVec3f;
|
||||
|
||||
typedef union
|
||||
{
|
||||
#if __clang__
|
||||
float clangVec __attribute__((__vector_size__(16)));
|
||||
#endif
|
||||
#if __SSE__
|
||||
__m128 mVec128;
|
||||
#endif
|
||||
float vec[4];
|
||||
} atVec4f;
|
||||
|
||||
|
||||
#ifndef NULL
|
||||
#ifdef __cplusplus
|
||||
#define NULL 0
|
||||
|
||||
Reference in New Issue
Block a user