Skip to content

Commit fde6ae9

Browse files
committed
Update documentation for array extensions
- Added array serialization/deserialization to features list - Expanded Array Extensions section with examples of [Double] and [Float] deserialization - Updated test count: 224 tests in 60 suites (was 174 in 55) - Added array serialization/deserialization to test coverage list
1 parent d5bcf89 commit fde6ae9

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

README.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ Pure Swift implementation with no Foundation dependencies, suitable for Swift Em
1515

1616
- Binary32 (single precision) and binary64 (double precision) formats
1717
- Little-endian and big-endian byte order support
18+
- Array serialization/deserialization for multiple Float/Double values
1819
- Zero-copy deserialization with unsafe memory operations
1920
- Cross-module inlining via `@inlinable` and `@_transparent`
2021
- Comprehensive special value handling (NaN, infinity, subnormals, signed zero)
21-
- 174 tests covering edge cases, performance, and concurrency
22+
- 224 tests covering edge cases, performance, and concurrency
2223

2324
## Installation
2425

@@ -112,9 +113,30 @@ let value = IEEE_754.Binary32.value(from: bytes)
112113
### Array Extensions
113114

114115
```swift
115-
// Convenience initializers
116+
// Single value serialization
116117
let doubleBytes: [UInt8] = [UInt8](3.14159)
117118
let floatBytes: [UInt8] = [UInt8](Float(3.14))
119+
120+
// Multiple Doubles from byte array
121+
let bytes: [UInt8] = [
122+
0x6E, 0x86, 0x1B, 0xF0, 0xF9, 0x21, 0x09, 0x40, // 3.14159
123+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F, // 1.0
124+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40 // 2.0
125+
]
126+
let doubles = [Double](bytes: bytes)
127+
// Optional([3.14159, 1.0, 2.0])
128+
129+
// Multiple Floats from byte array
130+
let floatBytes: [UInt8] = [
131+
0xD0, 0x0F, 0x49, 0x40, // 3.14159
132+
0x00, 0x00, 0x80, 0x3F, // 1.0
133+
0x00, 0x00, 0x00, 0x40 // 2.0
134+
]
135+
let floats = [Float](bytes: floatBytes)
136+
// Optional([3.14159, 1.0, 2.0])
137+
138+
// Big-endian deserialization
139+
let bigEndianDoubles = [Double](bytes: bytes, endianness: .big)
118140
```
119141

120142
### Special Values
@@ -160,14 +182,15 @@ Conforms to IEEE 754-2019:
160182

161183
## Testing
162184

163-
Test suite: 174 tests in 55 suites
185+
Test suite: 224 tests in 60 suites
164186

165187
Coverage:
166188
- Round-trip conversions
167189
- Special values (infinity, NaN, signed zero)
168190
- Edge cases (subnormals, extreme values, ULP boundaries)
169191
- Endianness handling
170192
- Bit pattern validation
193+
- Array serialization/deserialization
171194
- Performance benchmarks
172195
- Concurrent access safety
173196

0 commit comments

Comments
 (0)