- 
                Notifications
    
You must be signed in to change notification settings  - Fork 712
 
Closed
Description
Separated out of #486, ByteBuffer-core.swift has this:
private static func allocateAndPrepareRawMemory(bytes: Capacity, allocator: Allocator) -> UnsafeMutableRawPointer {
  let bytes = Int(bytes) /* Note(hh): this can fail on 32-bit (Int32 vs UInt32 Capacity)) */where Capacity is
typealias Capacity = UInt32This can fail on 32-bit platforms where Int cannot hold any UInt32 value (e.g. 0xDEADBEEF). Apparently the Int is used because of:
let sysMalloc: @convention(c) (Int) -> UnsafeMutableRawPointer? = mallocTBD: What should be used here. Maybe size_t? That would be better, but theoretically it would still break ByteBuffer on platforms wheresize_t is less than UInt32, e.g. Int32 sounds at least possible for size_t.
Presumably Int is also often used in Swift itself (e.g. the capacity of a UnsafeBufferPointer is probably an Int?)
Metadata
Metadata
Assignees
Labels
No labels