- Notifications
You must be signed in to change notification settings - Fork0
🔄 Safe and efficient bitwise rotation in Swift
License
NotificationsYou must be signed in to change notification settings
tgymnich/BitwiseRotate
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A swift package providing bitwise rotation operators forFixedWidthInteger
andSIMD
vectors with aFixedWidthInteger
scalar.This package is written in a sepcific way tocompile toror
androl
on x86. On ARM onlyUInt32
,UInt64
,Int32
andInt64
compile toror
. Rotations onSIMD
vectors don't yet compile to the most efficient instructions possible.
In your Package.swift add:
.package(url:"https://github.com/tgymnich/BitwiseRotate.git", from:"1.1.1")
letsomeBits:UInt8=0b01010100<<<3 // returns 0b10100010
letsomeBits:UInt8=0b01010100>>>3 // returns 0b10001010
letsomeBitVector=SIMD3<UInt8>(arrayLiteral:0b01010100,0b11011100,0b00011000)<<<1 // (0b10101000, 0b10111001, 0b00110000)
About
🔄 Safe and efficient bitwise rotation in Swift