mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-06 06:38:20 +00:00
remove Fixed_Byte_Buffer
This commit is contained in:
@@ -610,32 +610,6 @@ reinterpret_copy :: proc "contextless" ($T: typeid, ptr: rawptr) -> (value: T) {
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
Dynamic array with a fixed capacity buffer.
|
||||
|
||||
This type represents dynamic arrays with a fixed-size backing buffer. Upon
|
||||
allocating memory beyond reaching the maximum capacity, allocations from fixed
|
||||
byte buffers return `nil` and no error.
|
||||
*/
|
||||
Fixed_Byte_Buffer :: distinct [dynamic]byte
|
||||
|
||||
/*
|
||||
Create a fixed byte buffer from a slice.
|
||||
*/
|
||||
@(require_results)
|
||||
make_fixed_byte_buffer :: proc "contextless" (backing: []byte) -> Fixed_Byte_Buffer {
|
||||
s := transmute(Raw_Slice)backing
|
||||
d: Raw_Dynamic_Array
|
||||
d.data = s.data
|
||||
d.len = 0
|
||||
d.cap = s.len
|
||||
d.allocator = Allocator{
|
||||
procedure = nil_allocator_proc,
|
||||
data = nil,
|
||||
}
|
||||
return transmute(Fixed_Byte_Buffer)d
|
||||
}
|
||||
|
||||
/*
|
||||
General-purpose align formula.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user