File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ let package = Package(
2424 . executableTarget(
2525 name: " Kernel " ,
2626 dependencies: [
27+ " Support " ,
2728 " AsmSupport " ,
2829 . byName( name: " RaspberryPi " , condition: . when( traits: [ " RASPI " ] ) ) ,
2930 ] ,
@@ -37,6 +38,7 @@ let package = Package(
3738 ] ,
3839 ) ,
3940 . target( name: " Font " , swiftSettings: swiftSettings) ,
41+ . target( name: " Support " , swiftSettings: swiftSettings) ,
4042 . target( name: " AsmSupport " ) ,
4143 ] ,
4244)
Original file line number Diff line number Diff line change 1+ @_silgen_name ( " memcpy " )
2+ func memcpy(
3+ _ dst: UnsafeMutableRawPointer ,
4+ _ src: UnsafeRawPointer ,
5+ _ n: Int ,
6+ ) -> UnsafeMutableRawPointer {
7+ let dst = unsafe dst. bindMemory ( to: UInt8 . self, capacity: n)
8+ var dstSpan = unsafe MutableSpan( _unsafeStart: dst, count: n)
9+ let src = unsafe src. bindMemory ( to: UInt8 . self, capacity: n)
10+ let srcSpan = unsafe Span( _unsafeStart: src, count: n)
11+ for i in dstSpan. indices {
12+ dstSpan [ i] = srcSpan [ i]
13+ }
14+ return . init( dst)
15+ }
Original file line number Diff line number Diff line change 1+ @_silgen_name ( " memset " )
2+ func memset(
3+ _ dst: UnsafeMutableRawPointer ,
4+ _ val: CInt ,
5+ _ len: Int ,
6+ ) -> UnsafeMutableRawPointer {
7+ let dst = unsafe dst. bindMemory ( to: UInt8 . self, capacity: len)
8+ var span = unsafe MutableSpan( _unsafeStart: dst, count: len)
9+ for i in span. indices {
10+ span [ i] = UInt8 ( truncatingIfNeeded: val)
11+ }
12+ return . init( dst)
13+ }
You can’t perform that action at this time.
0 commit comments