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

Function ConvertNumGetType

source/script2.cpp:12937–12967  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12935};
12936
12937void ConvertNumGetType(ExprTokenType &aToken, NumGetParams &op)
12938{
12939 LPTSTR type = TokenToString(aToken); // No need to pass aBuf since any numeric value would not be recognized anyway.
12940 if (ctoupper(*type) == 'U') // Unsigned.
12941 {
12942 ++type; // Remove the first character from further consideration.
12943 op.is_signed = FALSE;
12944 }
12945 else
12946 op.is_signed = TRUE;
12947
12948 switch(ctoupper(*type)) // Override "size" and aResultToken.symbol if type warrants it. Note that the above has omitted the leading "U", if present, leaving type as "Int" vs. "Uint", etc.
12949 {
12950 case 'P': // Nothing extra needed in this case.
12951 op.num_size = sizeof(void *), op.is_integer = TRUE;
12952 break;
12953 case 'I':
12954 if (_tcschr(type, '6')) // Int64. It's checked this way for performance, and to avoid access violation if string is bogus and too short such as "i64".
12955 op.num_size = 8, op.is_integer = TRUE;
12956 else
12957 op.num_size = 4, op.is_integer = TRUE;
12958 break;
12959 case 'S': op.num_size = 2, op.is_integer = TRUE; break; // Short.
12960 case 'C': op.num_size = 1, op.is_integer = TRUE; break; // Char.
12961
12962 case 'D': op.num_size = 8, op.is_integer = FALSE; break; // Double.
12963 case 'F': op.num_size = 4, op.is_integer = FALSE; break; // Float.
12964
12965 default: op.num_size = 0; break;
12966 }
12967}
12968
12969void *BufferObject::sVTable = getVTable(); // Placing this here vs. in script_object.cpp improves some simple benchmarks by as much as 7%.
12970

Callers 1

BIF_DECLFunction · 0.85

Calls 2

TokenToStringFunction · 0.85
ctoupperFunction · 0.85

Tested by

no test coverage detected