File tree Expand file tree Collapse file tree 2 files changed +25
-6
lines changed
Expand file tree Collapse file tree 2 files changed +25
-6
lines changed Original file line number Diff line number Diff line change 1+ name : Build and Test
2+ on :
3+ push :
4+ branches : [ main ]
5+ pull_request :
6+ branches : [ main ]
7+
8+ jobs :
9+ test :
10+ runs-on : ubuntu-latest
11+ container : swift:noble
12+ steps :
13+ - name : Checkout
14+ uses : actions/checkout@v4
15+ - name : Lint
16+ run : swift-format lint --recursive --strict --parallel .
17+ - name : Build
18+ run : swift build
19+ - name : Test
20+ run : swift test
21+
22+
Original file line number Diff line number Diff line change @@ -38,10 +38,7 @@ struct Base64 {
3838 return [ ]
3939 }
4040
41- var len = count
42- if len > bytes. count {
43- len = bytes. count
44- }
41+ let len = min ( bytes. count, count)
4542
4643 var offset : Int = 0
4744 var c1 : UInt8
@@ -51,7 +48,7 @@ struct Base64 {
5148 while offset < len {
5249 c1 = bytes [ offset] & 0xff
5350 offset &+= 1
54- result. append ( encodingTable [ Int ( truncatingIfNeeded: ( c1 >> 2 ) & 0x3f ) ] )
51+ result. append ( encodingTable [ Int ( truncatingIfNeeded: ( c1 & >> 2 ) & 0x3f ) ] )
5552 c1 = ( c1 & 0x03 ) &<< 4
5653 if offset >= len {
5754 result. append ( encodingTable [ Int ( truncatingIfNeeded: c1 & 0x3f ) ] )
@@ -79,7 +76,7 @@ struct Base64 {
7976 }
8077
8178 private static func char64( of x: UInt8 ) -> UInt8 {
82- x > 127 ? 255 : decodingTable [ Int ( x) ]
79+ x > 127 ? 255 : decodingTable [ Int ( truncatingIfNeeded : x) ]
8380 }
8481
8582 @usableFromInline
You can’t perform that action at this time.
0 commit comments