zcopy   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/base/base.xtm

Implementation

(bind-func zcopy:[!a,!a,mzone*,mzone*]*
  "generic \"catch-all\" zcopy"
  (lambda (x fromz toz)
    (if (llvm_ptr_in_zone fromz (convert x))
        (let ((size (obj-size x 1)) ;; get size of x with 1 level of dereference
              (newdat (convert (llvm_zone_malloc toz size))))
          (memcpy (convert newdat) (convert x) size)
          newdat)
        x)))


Back to Index

Similar Entries