Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collapsed ints in binary kv1 implemented in CS:GO #35

Open
xPaw opened this issue Jan 19, 2021 · 1 comment
Open

Collapsed ints in binary kv1 implemented in CS:GO #35

xPaw opened this issue Jan 19, 2021 · 1 comment

Comments

@xPaw
Copy link
Member

xPaw commented Jan 19, 2021

	// Data type
	enum types_t
	{
		TYPE_NONE = 0,
		TYPE_STRING,
		TYPE_INT,
		TYPE_FLOAT,
		TYPE_PTR,
		TYPE_WSTRING,
		TYPE_COLOR,
		TYPE_UINT64,
		TYPE_COMPILED_INT_BYTE,			// hack to collapse 1 byte ints in the compiled format
		TYPE_COMPILED_INT_0,			// hack to collapse 0 in the compiled format
		TYPE_COMPILED_INT_1,			// hack to collapse 1 in the compiled format
		TYPE_NUMTYPES, 
	};

Looks like they ported this back from Source 2. This is not great beacuse the enum has conflicting values.

@yaakov-h
Copy link
Member

		case TYPE_COMPILED_INT_0:
			{
				// only for dense storage purposes, flip back to preferred internal format
				dat->m_iDataType = TYPE_INT;
				dat->m_iValue = 0;
				break;
			}

 		case TYPE_COMPILED_INT_1:
			{
				// only for dense storage purposes, flip back to preferred internal format
				dat->m_iDataType = TYPE_INT;
				dat->m_iValue = 1;
				break;
			}

 		case TYPE_COMPILED_INT_BYTE:
			{
				// only for dense storage purposes, flip back to preferred internal format
				dat->m_iDataType = TYPE_INT;
				dat->m_iValue = buffer.GetChar();
				break;
			}

its just an int but using less space on disk (2 bytes) for a single byte value or (1 byte) boolean value. plus the key name of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants