MCPcopy Create free account
hub / github.com/WheretIB/nullc / SwapObjects

Method SwapObjects

NULLC/StdLib.cpp:607–622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

605}
606
607void NULLC::SwapObjects(NULLCRef l, NULLCRef r)
608{
609 if(l.typeID != r.typeID)
610 {
611 nullcThrowError("ERROR: types don't match (%s ref, %s ref)", &linker->exSymbols[linker->exTypes[r.typeID].offsetToName], &linker->exSymbols[linker->exTypes[l.typeID].offsetToName]);
612 return;
613 }
614 unsigned size = linker->exTypes[l.typeID].size;
615
616 char tmpStack[512];
617 // $$ should use some extendable static storage for big objects
618 char *tmp = size < 512 ? tmpStack : (char*)NULLC::AllocObject(size);
619 memcpy(tmp, l.ptr, size);
620 memcpy(l.ptr, r.ptr, size);
621 memcpy(r.ptr, tmp, size);
622}
623
624int NULLC::CompareObjects(NULLCRef l, NULLCRef r)
625{

Callers

nothing calls this directly

Calls 1

nullcThrowErrorFunction · 0.70

Tested by

no test coverage detected