Reputation: 5
I heard that in 32bit computer(1990~2000?) had to use a 8 size data like below; (that I heard of... there was no 8 size type, then... ) they used like this;
// 8 size
typedef union _LARGE_INTEGER {
struct {
DWORD LowPart;
LONG HighPart;
} DUMMYSTRUCTNAME;
struct {
DWORD LowPart;
LONG HighPart;
} u;
LONGLONG QuadPart; // I'm not sure of this part;
} LARGE_INTEGER;
So I want to try to make a 16 size type for my own it is ok to use it like this??
// 16 size
typedef union INTERGER128 {
struct {
LONGLONG LowPart;
LONGLONG HighPart;
} u;
} _INTERGER128;
Upvotes: 0
Views: 219
Reputation: 5
I used another way to may a 16 size variable
__declspec(align(16)) struct aa {
long long a;
long long b;
char c;
}
this way you can make a 16 size padding in structs
Upvotes: 0
Reputation: 238301
Is there a type for 16 size data?
There are no standard fundamental types that are guaranteed to be 16 bytes. In some language implementations, there is a 128 bit integer type as a language extension.
typedef union INTERGER128 { LONGLONG LowPart; LONGLONG HighPart; } _INTERGER128;
I see no case where your suggested union would be useful. Furthermore, the size of that union would be same as LONGLONG
. You haven't shown how that is defined but if it is long long
then on most systems that is a 64 bit type; not 128.
You can define a custom 128 bit class like this:
struct INTERGER128 {
std::uint64_t low;
std::uint64_t high;
};
P.S. _INTERGER128
and _LARGE_INTEGER
identifiers are reserved to the language implementation. You should use another name. Or just don't define a pointless alias.
P.P.S. There is a proposal for standard library based wide integers: p0539
Upvotes: 2