v / vlib / encoding / binary / unions.v
30 lines · 25 sloc · 396 bytes · 3caa1b7297e2959633adb39f1422765aba8a4d50
Raw
1// Copyright (c) 2025 Alexander Medvednikov. All rights reserved.
2// Use of this source code is governed by an MIT license
3// that can be found in the LICENSE file.
4module binary
5
6// Unions used across the little endian/big endian conversion routines.
7
8union U16 {
9mut:
10 b [2]u8
11 u u16
12}
13
14union U32 {
15mut:
16 b [4]u8
17 u u32
18}
19
20union U64 {
21mut:
22 b [8]u8
23 u u64
24}
25
26union F32 {
27mut:
28 b [4]u8
29 u f32
30}
31