More on refactor
This commit is contained in:
parent
1a0b36e390
commit
08a550f47a
2 changed files with 39 additions and 39 deletions
|
@ -6,15 +6,6 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
typedef union {
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
Int value : 31;
|
|
||||||
Int signal : 1;
|
|
||||||
} int_with_msb;
|
|
||||||
Int signed_int;
|
|
||||||
} SignedInt;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This will get the most significant bit of the Int value. If the most significant bit is 1 then the number is
|
* This will get the most significant bit of the Int value. If the most significant bit is 1 then the number is
|
||||||
* 0x11111111 --> equals to -1 integer
|
* 0x11111111 --> equals to -1 integer
|
||||||
|
|
|
@ -3,40 +3,49 @@
|
||||||
* Types for x86 architectures
|
* Types for x86 architectures
|
||||||
*/
|
*/
|
||||||
#if defined(__x86_64__)
|
#if defined(__x86_64__)
|
||||||
//Signed type alias
|
//Signed type alias
|
||||||
typedef int Int;
|
typedef int Int;
|
||||||
typedef long Long;
|
typedef long Long;
|
||||||
typedef char Char;
|
typedef char Char;
|
||||||
typedef short Short;
|
typedef short Short;
|
||||||
|
|
||||||
//IEEE floating point alias
|
typedef union {
|
||||||
typedef float Float;
|
struct
|
||||||
typedef double Double;
|
{
|
||||||
|
Int value : 31;
|
||||||
|
Int signal : 1;
|
||||||
|
} int_with_msb;
|
||||||
|
Int signed_int;
|
||||||
|
} SignedInt;
|
||||||
|
|
||||||
//Unsigned type alias
|
//IEEE floating point alias
|
||||||
typedef unsigned char UChar;
|
typedef float Float;
|
||||||
typedef unsigned short UShort;
|
typedef double Double;
|
||||||
typedef unsigned int UInt;
|
|
||||||
typedef unsigned long ULong;
|
|
||||||
|
|
||||||
//SSE DataTypes
|
//Unsigned type alias
|
||||||
#define INT_LEN_64 2
|
typedef unsigned char UChar;
|
||||||
#define INT_LEN_128 4
|
typedef unsigned short UShort;
|
||||||
#define INT_LEN_256 8
|
typedef unsigned int UInt;
|
||||||
#define INT_LEN_512 16
|
typedef unsigned long ULong;
|
||||||
|
|
||||||
#define LONG_LEN_64 1
|
//SSE DataTypes
|
||||||
#define LONG_LEN_128 2
|
#define INT_LEN_64 2
|
||||||
#define LONG_LEN_256 4
|
#define INT_LEN_128 4
|
||||||
#define LONG_LEN_512 8
|
#define INT_LEN_256 8
|
||||||
|
#define INT_LEN_512 16
|
||||||
|
|
||||||
//Masks
|
#define LONG_LEN_64 1
|
||||||
#define MASK_32 0xFFFFFFFF
|
#define LONG_LEN_128 2
|
||||||
#define MASK_16 0xFFFF
|
#define LONG_LEN_256 4
|
||||||
#define MASK_8 0xFF
|
#define LONG_LEN_512 8
|
||||||
|
|
||||||
//Shifts
|
//Masks
|
||||||
#define SHIFT_32 32
|
#define MASK_32 0xFFFFFFFF
|
||||||
#define SHIFT_16 16
|
#define MASK_16 0xFFFF
|
||||||
#define SHIFT_8 8
|
#define MASK_8 0xFF
|
||||||
|
|
||||||
|
//Shifts
|
||||||
|
#define SHIFT_32 32
|
||||||
|
#define SHIFT_16 16
|
||||||
|
#define SHIFT_8 8
|
||||||
#endif
|
#endif
|
Loading…
Reference in a new issue