[MetaballsKit] Add Memory file
This commit is contained in:
parent
aa48b29e21
commit
cceb00dfe0
2 changed files with 21 additions and 0 deletions
17
MetaballsKit/Memory.swift
Normal file
17
MetaballsKit/Memory.swift
Normal file
|
@ -0,0 +1,17 @@
|
|||
//
|
||||
// Memory.swift
|
||||
// Metaballs
|
||||
//
|
||||
// Created by Eryn Wells on 8/6/17.
|
||||
// Copyright © 2017 Eryn Wells. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension UnsafeMutableRawPointer {
|
||||
func writeAndAdvance<T>(value: inout T) -> UnsafeMutableRawPointer {
|
||||
let stride = MemoryLayout.stride(ofValue: value)
|
||||
copyBytes(from: &value, count: stride)
|
||||
return advanced(by: stride)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue