-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtypes.h
More file actions
37 lines (32 loc) · 667 Bytes
/
Copy pathtypes.h
File metadata and controls
37 lines (32 loc) · 667 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once
// Bit fields making up IEE754 floats
typedef union {
float f;
struct {
uint32_t mantissa:23;
uint32_t exp:8;
uint32_t sign:1;
} b;
} split_float32;
typedef union {
double d;
struct {
uint64_t mantissa:52;
uint64_t exp:11;
uint64_t sign:1;
} b;
} split_float64;
// A 64 byte cacheline whose values can be accessed
// in whatever format is convenient
//
// cacheline cl;
// cl.float32[4].f = 3.14f;
// printf("%x\n", cl.float32[4].b.mantissa);
typedef union {
uint8_t byte[64];
uint16_t word[32];
uint32_t dword[16];
uint32_t qword[8];
split_float32 float32[16];
split_float64 float64[8];
} cacheline;