Import std.ffi.mem
std.ffi.mem
Raw memory, which Unsafe code allocates, resizes, fills, copies, compares, and gives back, through the runtime, whose C functions a program can declare as it likes. Sizes are Int64s, as SizeOf's and two Ptrs' difference are, so one that went below 0 panics instead of wrapping around to a huge size.
std/ffi/mem.fb
Types
Mem
struct
Public Struct Mem
Mem's Static Methods. What Alloc, AllocUninitialized, and Resize give, Free gives back, and what AllocAligned gives, FreeAligned.
-
bytesof new memory, all 0. Panics whenbytesis negative, or there isn't that much. -
@PanicsAtCaller Public Unsafe Static Method AllocUninitialized(bytes: Int64): Ptr<Void>static method #bytesof new memory, as Alloc gives, but not set to 0, so it holds whatever was there, which Unsafe code writes before it reads. Panics whenbytesis negative, or there isn't that much. -
@PanicsAtCaller Public Unsafe Static Method AllocAligned(bytes: Int64, alignment: Int64): Ptr<Void>static method #bytesof new memory, all 0, at an address that's a multiple ofalignment, a power of two, as SIMD code and some C libraries need. Only FreeAligned gives it back, and Resize doesn't take it. Panics whenbytesis negative,alignmentisn't a power of two, or there isn't that much. -
Gives back what AllocAligned gave. Null is nothing to give back.
-
@PanicsAtCaller Public Unsafe Static Method Resize(memory: Ptr<Void>, bytes: Int64): Ptr<Void>static method #What Alloc, AllocUninitialized, or Resize gave, in
bytesofmemory, which may have moved: it keeps what fits, and what it adds isn't 0. Null is new memory. Panics whenbytesis negative, or there isn't that much. -
Gives back what Alloc, AllocUninitialized, or Resize gave. Null is nothing to give back.
-
@PanicsAtCaller Public Unsafe Static Method Copy(destination: Ptr<Void>, source: Ptr<Void>, bytes: Int64)static method #Copies
bytesfromsourcetodestination, which can overlap. Panics whenbytesis negative, or when it isn't 0 and either is Null. -
@PanicsAtCaller Public Unsafe Static Method Fill(destination: Ptr<Void>, value: UInt8, bytes: Int64)static method #Sets
bytesof memory fromdestinationon tovalue. Panics whenbytesis negative, or when it isn't 0 anddestinationis Null. -
@PanicsAtCaller Public Unsafe Static Method Compare(a: Ptr<Void>, b: Ptr<Void>, bytes: Int64): Int32static method #Compares
bytesof memory atawith as many atb: 0 when they're the same, or -1 or 1 as the first byte that differs, read as a UInt8, is lower ataor atb. Panics whenbytesis negative, or when it isn't 0 and either is Null.
Report an issue with this page or with FutureBlitz on GitHub.