a type is defined by composing bitmasks of its attributes T(Bitmask)
|1 is Float or Integer
|2 is signed or unsigned
|4 increase 32bits-> width x2(long long/double)
|8 reduce 32bits-> width 1/2 (short)
|16 reduce/increase width extra (short->short=1byte or long->long double/quad)
|32 is Volatile
|64 is Const
|128 Sign 0-/1+ if HasSign
|256 Register Storage Class
|512 Align In Memory
|1024 Thread Local
|2048 is Pointer?
|4096 Restrict Pointer Aliasing
Should cost only 1 bit per each extra attribute
Name:
F r o z e n V o i d !!mJCwdV5J0Xy2A212011-12-02 4:50
|1 is Float or Integer
|2 is signed or unsigned
|4 increase 32bits-> width x2(long long/double)
|8 reduce 32bits-> width 1/2 (short)
|16 reduce/increase width extra (short->short=1byte or long->long double/quad)
|32 is Volatile or (Potential) Register
|64 is Const
--|128 Sign 0-/1+ if HasSign (number stores its own sign)
--|256 Register Storage Class merge with volatile/register
--|512 Align In Memory(should be preprocessor directive)
--|1024 Thread Local(should be default for in-thread vars, or preprocessor setting)
|2048 is Pointer?(pointer should be using the fields above+this to stored number 0-2^5 of pointer level *** is 3, **** is 4,32 *'s=32)
|4096 Restrict Pointer Aliasing
Name:
F r o z e n V o i d !!mJCwdV5J0Xy2A212011-12-02 4:57
Further optimizied
|1 is Float or Integer
|2 is signed or unsigned
better width storage: 1,2,4,8=00,01,10,11[char,short,int,long long] = 2 bits=00,01,10,11[short float,float,double,long double]
|4 type bit 1
|8 type bit 2
--|16
|32 is Volatile or (Potential) Register
|64 is Const
--|128 Sign 0-/1+ if HasSign (number stores its own sign)
--|256 Register Storage Class merge with volatile/register
--|512 Align In Memory(should be preprocessor directive)
--|1024 Thread Local(should be default for in-thread vars, or preprocessor setting)
|2048 is Pointer?(pointer should be using the fields above+this to stored number 0-2^5 of pointer level *** is 3, **** is 4,32 *'s=32)
|4096 Restrict Pointer Aliasing
Name:
F r o z e n V o i d !!mJCwdV5J0Xy2A212011-12-02 5:05
Even Further optimizied
|1 is Float or Integer
|2 is signed or unsigned
better width storage: 1,2,4,8=00,01,10,11[char,short,int,long long] = 2 bits=00,01,10,11[short float,float,double,long double]
|4 type bit 1
|8 type bit 2
|16 is Volatile or (Potential) Register
|32 is Const/Restrict Pointer Aliasing
|64-256 Pointer data typebit 1-
|128 Pointer data typebit 2 [pointer00=not a pointer,01 pointer*,10=pointer**,11=pointer***]
Name:
F r o z e n V o i d !!mJCwdV5J0Xy2A212011-12-02 5:07
Now a byte (256 types) represents the entire gamut of C types. >>1 i'll implement this as a macro
Name:
F r o z e n V o i d !!mJCwdV5J0Xy2A212011-12-02 5:45
On other hand its will be useless, since its not referencing anything obvious. so it shouldn't be a macro, but a bytecode for storing the type.
Name:
Anonymous2011-12-02 7:28
>>6
No need to thank me;
typedef unsigned char A;
typedef unsigned short B;
typedef unsigned int C;
typedef unsigned long long D;
typedef signed char E;
typedef signed short F;
typedef signed int G;
typedef signed long long H;
typedef char I;
typedef short J;
typedef int K;
typedef long long L;
typedef float M;
typedef double N;
typedef long double O;
typedef restrict int* P;
typedef restrict char* Q;
typedef short* R;
typedef float* S;
typedef double* T;
typedef long double* U;
typedef void V;
typedef void* W;
typedef int* X;
typedef char* Y;
typedef long long* Z;