@@ -9,15 +9,19 @@ open System
9
9
10
10
[<MeasureAnnotatedAbbreviation>] type bool <[< Measure >] 'm > = bool
11
11
[<MeasureAnnotatedAbbreviation>] type byte <[< Measure >] 'm > = byte
12
+ [<MeasureAnnotatedAbbreviation>] type uint16 <[< Measure >] 'm > = uint16
12
13
[<MeasureAnnotatedAbbreviation>] type uint64 <[< Measure >] 'm > = uint64
13
14
[<MeasureAnnotatedAbbreviation>] type Guid <[< Measure >] 'm > = Guid
15
+ [<MeasureAnnotatedAbbreviation>] type char <[< Measure >] 'm > = char
14
16
[<MeasureAnnotatedAbbreviation>] type string <[< Measure >] 'm > = string
15
17
[<MeasureAnnotatedAbbreviation>] type TimeSpan <[< Measure >] 'm > = TimeSpan
16
18
[<MeasureAnnotatedAbbreviation>] type DateTime <[< Measure >] 'm > = DateTime
17
19
[<MeasureAnnotatedAbbreviation>] type DateTimeOffset <[< Measure >] 'm > = DateTimeOffset
18
20
#if NET6_ 0_ OR_ GREATER
19
21
[<MeasureAnnotatedAbbreviation>] type DateOnly <[< Measure >] 'm > = DateOnly
20
22
[<MeasureAnnotatedAbbreviation>] type TimeOnly <[< Measure >] 'm > = TimeOnly
23
+ #else
24
+ [<MeasureAnnotatedAbbreviation>] type uint32 <[< Measure >] 'm > = uint32
21
25
#endif
22
26
23
27
module private Unsafe =
@@ -32,59 +36,77 @@ type UMX =
32
36
33
37
static member inline tag <[< Measure >] 'm > ( x : bool ) : bool < 'm > = Unsafe.cast x
34
38
static member inline tag <[< Measure >] 'm > ( x : byte ) : byte < 'm > = Unsafe.cast x
39
+ static member inline tag <[< Measure >] 'm > ( x : sbyte ) : sbyte < 'm > = Unsafe.cast x
35
40
static member inline tag <[< Measure >] 'm > ( x : int ) : int < 'm > = Unsafe.cast x
36
41
static member inline tag <[< Measure >] 'm > ( x : int16 ) : int16 < 'm > = Unsafe.cast x
37
42
static member inline tag <[< Measure >] 'm > ( x : int64 ) : int64 < 'm > = Unsafe.cast x
43
+ static member inline tag <[< Measure >] 'm > ( x : uint16 ) : uint16 < 'm > = Unsafe.cast x
38
44
static member inline tag <[< Measure >] 'm > ( x : uint64 ) : uint64 < 'm > = Unsafe.cast x
39
45
static member inline tag <[< Measure >] 'm > ( x : float32 ) : float32 < 'm > = Unsafe.cast x
40
46
static member inline tag <[< Measure >] 'm > ( x : float ) : float < 'm > = Unsafe.cast x
41
47
static member inline tag <[< Measure >] 'm > ( x : decimal ) : decimal < 'm > = Unsafe.cast x
42
48
static member inline tag <[< Measure >] 'm > ( x : Guid ) : Guid < 'm > = Unsafe.cast x
49
+ static member inline tag <[< Measure >] 'm > ( x : char ) : char < 'm > = Unsafe.cast x
43
50
static member inline tag <[< Measure >] 'm > ( x : string ) : string < 'm > = Unsafe.cast x
44
51
static member inline tag <[< Measure >] 'm > ( x : TimeSpan ) : TimeSpan < 'm > = Unsafe.cast x
45
52
static member inline tag <[< Measure >] 'm > ( x : DateTime ) : DateTime < 'm > = Unsafe.cast x
46
53
static member inline tag <[< Measure >] 'm > ( x : DateTimeOffset ) : DateTimeOffset < 'm > = Unsafe.cast x
47
54
#if NET6_ 0_ OR_ GREATER
48
55
static member inline tag <[< Measure >] 'm > ( x : DateOnly ) : DateOnly < 'm > = Unsafe.cast x
49
56
static member inline tag <[< Measure >] 'm > ( x : TimeOnly ) : TimeOnly < 'm > = Unsafe.cast x
57
+ static member inline tag <[< Measure >] 'm > ( x : uint ) : uint < 'm > = Unsafe.cast x
58
+ #else
59
+ static member inline tag <[< Measure >] 'm > ( x : uint32 ) : uint32 < 'm > = Unsafe.cast x
50
60
#endif
51
61
52
62
static member inline untag <[< Measure >] 'm > ( x : bool < 'm >) : bool = Unsafe.cast x
53
63
static member inline untag <[< Measure >] 'm > ( x : byte < 'm >) : byte = Unsafe.cast x
64
+ static member inline untag <[< Measure >] 'm > ( x : sbyte < 'm >) : sbyte = Unsafe.cast x
54
65
static member inline untag <[< Measure >] 'm > ( x : int < 'm >) : int = Unsafe.cast x
55
66
static member inline untag <[< Measure >] 'm > ( x : int16 < 'm >) : int16 = Unsafe.cast x
56
67
static member inline untag <[< Measure >] 'm > ( x : int64 < 'm >) : int64 = Unsafe.cast x
68
+ static member inline untag <[< Measure >] 'm > ( x : uint16 < 'm >) : uint16 = Unsafe.cast x
57
69
static member inline untag <[< Measure >] 'm > ( x : uint64 < 'm >) : uint64 = Unsafe.cast x
58
70
static member inline untag <[< Measure >] 'm > ( x : float32 < 'm >) : float32 = Unsafe.cast x
59
71
static member inline untag <[< Measure >] 'm > ( x : float < 'm >) : float = Unsafe.cast x
60
72
static member inline untag <[< Measure >] 'm > ( x : decimal < 'm >) : decimal = Unsafe.cast x
61
73
static member inline untag <[< Measure >] 'm > ( x : Guid < 'm >) : Guid = Unsafe.cast x
74
+ static member inline untag <[< Measure >] 'm > ( x : char < 'm >) : char = Unsafe.cast x
62
75
static member inline untag <[< Measure >] 'm > ( x : string < 'm >) : string = Unsafe.cast x
63
76
static member inline untag <[< Measure >] 'm > ( x : TimeSpan < 'm >) : TimeSpan = Unsafe.cast x
64
77
static member inline untag <[< Measure >] 'm > ( x : DateTime < 'm >) : DateTime = Unsafe.cast x
65
78
static member inline untag <[< Measure >] 'm > ( x : DateTimeOffset < 'm >) : DateTimeOffset = Unsafe.cast x
66
79
#if NET6_ 0_ OR_ GREATER
67
80
static member inline untag <[< Measure >] 'm > ( x : DateOnly < 'm >) : DateOnly = Unsafe.cast x
68
81
static member inline untag <[< Measure >] 'm > ( x : TimeOnly < 'm >) : TimeOnly = Unsafe.cast x
82
+ static member inline untag <[< Measure >] 'm > ( x : uint < 'm >) : uint = Unsafe.cast x
83
+ #else
84
+ static member inline untag <[< Measure >] 'm > ( x : uint32 < 'm >) : uint32 = Unsafe.cast x
69
85
#endif
70
86
71
87
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : bool < 'm1 >) : bool < 'm2 > = Unsafe.cast x
72
88
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : byte < 'm1 >) : byte < 'm2 > = Unsafe.cast x
89
+ static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : sbyte < 'm1 >) : sbyte < 'm2 > = Unsafe.cast x
73
90
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : int < 'm1 >) : int < 'm2 > = Unsafe.cast x
74
91
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : int16 < 'm1 >) : int16 < 'm2 > = Unsafe.cast x
75
92
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : int64 < 'm1 >) : int64 < 'm2 > = Unsafe.cast x
93
+ static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : uint16 < 'm1 >) : uint16 < 'm2 > = Unsafe.cast x
76
94
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : uint64 < 'm1 >) : uint64 < 'm2 > = Unsafe.cast x
77
95
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : float < 'm1 >) : float < 'm2 > = Unsafe.cast x
78
96
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : float32 < 'm1 >) : float32 < 'm2 > = Unsafe.cast x
79
97
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : decimal < 'm1 >) : decimal < 'm2 > = Unsafe.cast x
80
98
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : Guid < 'm1 >) : Guid < 'm2 > = Unsafe.cast x
99
+ static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : char < 'm1 >) : char < 'm2 > = Unsafe.cast x
81
100
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : string < 'm1 >) : string < 'm2 > = Unsafe.cast x
82
101
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : TimeSpan < 'm1 >) : TimeSpan < 'm2 > = Unsafe.cast x
83
102
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : DateTime < 'm1 >) : DateTime < 'm2 > = Unsafe.cast x
84
103
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : DateTimeOffset < 'm1 >) : DateTimeOffset < 'm2 > = Unsafe.cast x
85
104
#if NET6_ 0_ OR_ GREATER
86
105
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : DateOnly < 'm1 >) : DateOnly < 'm2 > = Unsafe.cast x
87
106
static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : TimeOnly < 'm1 >) : TimeOnly < 'm2 > = Unsafe.cast x
107
+ static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : uint < 'm1 >) : uint < 'm2 > = Unsafe.cast x
108
+ #else
109
+ static member inline cast <[< Measure >] 'm1 , [< Measure >] 'm2 > ( x : uint32 < 'm1 >) : uint32 < 'm2 > = Unsafe.cast x
88
110
#endif
89
111
90
112
0 commit comments