We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BigIntStorage.capacity
From developer.apple.com/ManagedBufferPointer/Capacity:
This value may be nontrivial to compute; it is usually a good idea to store this information in the “header” area when an instance is created.
From ManagedBuffer.swift:
extension ManagedBufferPointer { @inlinable @available(OpenBSD, unavailable, message: "malloc_size is unavailable.") public var capacity: Int { return ( _capacityInBytes &- ManagedBufferPointer._elementOffset ) / MemoryLayout<Element>.stride } }
Where _capacityInBytes is defined as malloc_size:
_capacityInBytes
malloc_size
static inline __swift_size_t _swift_stdlib_malloc_size(const void *ptr) { extern __swift_size_t malloc_size(const void *); return malloc_size(ptr); }
capacity: Int
Header
capacity
[1bit - isNegative][31 bits - count][32 bits - capacity]
The text was updated successfully, but these errors were encountered:
Additional reference: loftwareArrayOfOptional (Dave Abrahams thingy).
Sorry, something went wrong.
No branches or pull requests
From developer.apple.com/ManagedBufferPointer/Capacity:
Under the hood
From ManagedBuffer.swift:
Where
_capacityInBytes
is defined asmalloc_size
:Solutions
capacity: Int
inHeader
. Header size: 2 words.capacity
inside existing header. Header size: 1 word. Layout[1bit - isNegative][31 bits - count][32 bits - capacity]
The text was updated successfully, but these errors were encountered: