mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			13 lines
		
	
	
		
			328 B
		
	
	
	
		
			Swift
		
	
			
		
		
	
	
			13 lines
		
	
	
		
			328 B
		
	
	
	
		
			Swift
		
	
 | 
						|
internal extension FixedWidthInteger {
 | 
						|
 | 
						|
    init?(fromBigEndianBytes bytes: [UInt8]) {
 | 
						|
        guard bytes.count == MemoryLayout<Self>.size else { return nil }
 | 
						|
        self = bytes.reduce(0) { ($0 << 8) | Self($1) }
 | 
						|
    }
 | 
						|
 | 
						|
    var bigEndianBytes: [UInt8] {
 | 
						|
        return withUnsafeBytes(of: bigEndian) { [UInt8]($0) }
 | 
						|
    }
 | 
						|
}
 |