MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / GetBufferObjectPtr

Function GetBufferObjectPtr

source/script2.cpp:12971–12986  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12969void *BufferObject::sVTable = getVTable(); // Placing this here vs. in script_object.cpp improves some simple benchmarks by as much as 7%.
12970
12971void GetBufferObjectPtr(ResultToken &aResultToken, IObject *obj, size_t &aPtr, size_t &aSize)
12972{
12973 if (BufferObject::IsInstanceExact(obj))
12974 {
12975 // Some primitive benchmarks showed that this was about as fast as passing
12976 // a pointer directly, whereas invoking the properties (below) doubled the
12977 // overall time taken by NumGet/NumPut.
12978 aPtr = (size_t)((BufferObject *)obj)->Data();
12979 aSize = ((BufferObject *)obj)->Size();
12980 }
12981 else
12982 {
12983 if (GetObjectPtrProperty(obj, _T("Ptr"), aPtr, aResultToken))
12984 GetObjectPtrProperty(obj, _T("Size"), aSize, aResultToken);
12985 }
12986}
12987
12988void GetBufferObjectPtr(ResultToken &aResultToken, IObject *obj, size_t &aPtr)
12989// See above for comments.

Callers 4

__NewMethod · 0.85
BIF_DECLFunction · 0.85
ConvertNumGetTargetFunction · 0.85
InvokeMethod · 0.85

Calls 3

GetObjectPtrPropertyFunction · 0.85
DataMethod · 0.80
SizeMethod · 0.80

Tested by

no test coverage detected