Int - leacode/SwiftWings GitHub Wiki
Source: Sources/Extensions/Foundation/Int
Tests: Tests/Extensions/Int
-
bytes(_:)exposes big-endian byte arrays for serialization. -
halfdivides safely when magnitude is greater than 1. -
BinaryIntegeradditions: Simplified/Traditional Chinese spell-outs,isEven, and conversions toDouble/String.
- Delegates to
Double.chineseMoneySpellso integers can be spelled in formal Chinese currency without manual casting.
let value = 42
print(value.bytes()) // [0, 0, 0, 0, 0, 0, 0, 42] on 64-bit
print(value.half as Any) // Optional(21)
print(value.simplifiedChinese ?? "") // "εεδΊ"
print(value.chineseMoneySpell ?? "") // "θζΎθ΄°εζ΄"