standalone: VoxelForgeCore link-safe next to Unreal -- internals in vfcore::detail, symbol check
- The copied generator, mesher and Compat stand-ins compile inside vfcore::detail. - CheckCoreSymbols.ps1 (run by Build.ps1) fails on any unqualified Unreal-style symbol in the library: 16,255 on557f6aa, 0 now. A UE 5.7 CoreMinimal.h + VoxelForgeCore.h smoke compile passes. - Output identical: 11 hash rows at W1/W8, routes 5642/5642, look/passage/far audits pass, bad-shell control fails, six captures byte-identical. Cost, measured by me interleaved (8 workers, cold, 4 runs each, first run excluded): 0.963 s vs 0.937 s for557f6aa, ~27 ms in shape compilation; same math, so codegen/inlining. To be found. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MmSoF64BbRFmk9C3p1VsBJ
This commit is contained in:
1 parent
557f6aac30
commit
aeeedaa73d
11 files changed
+461
-87
No files matched your search
@@ -1,8 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <charconv>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
namespace VFJson
|
||||
{
|
||||
@@ -27,7 +37,7 @@ namespace VFJson
|
||||
return It == O.end() ? Null : It->second;
|
||||
}
|
||||
double Number(double Fallback = 0.0) const { return IsNumber() ? std::get<double>(Data) : Fallback; }
|
||||
int64 Integer(int64 Fallback = 0) const { return IsNumber() ? static_cast<int64>(std::get<double>(Data)) : Fallback; }
|
||||
std::int64_t Integer(std::int64_t Fallback = 0) const { return IsNumber() ? static_cast<std::int64_t>(std::get<double>(Data)) : Fallback; }
|
||||
bool Boolean(bool Fallback = false) const { return std::holds_alternative<bool>(Data) ? std::get<bool>(Data) : Fallback; }
|
||||
const std::string& String() const { static const std::string Empty; return IsString() ? std::get<std::string>(Data) : Empty; }
|
||||
};
|
||||
@@ -49,23 +59,23 @@ namespace VFJson
|
||||
size_t Position = 0;
|
||||
void SkipSpace() { while (Position < Text.size() && static_cast<unsigned char>(Text[Position]) <= 0x20) ++Position; }
|
||||
bool Consume(char C) { SkipSpace(); if (Position < Text.size() && Text[Position] == C) { ++Position; return true; } return false; }
|
||||
static void AppendUtf8(std::string& Out, uint32 Code)
|
||||
static void AppendUtf8(std::string& Out, std::uint32_t Code)
|
||||
{
|
||||
if (Code <= 0x7f) Out.push_back(static_cast<char>(Code));
|
||||
else if (Code <= 0x7ff) { Out.push_back(static_cast<char>(0xc0 | (Code >> 6))); Out.push_back(static_cast<char>(0x80 | (Code & 0x3f))); }
|
||||
else if (Code <= 0xffff) { Out.push_back(static_cast<char>(0xe0 | (Code >> 12))); Out.push_back(static_cast<char>(0x80 | ((Code >> 6) & 0x3f))); Out.push_back(static_cast<char>(0x80 | (Code & 0x3f))); }
|
||||
else { Out.push_back(static_cast<char>(0xf0 | (Code >> 18))); Out.push_back(static_cast<char>(0x80 | ((Code >> 12) & 0x3f))); Out.push_back(static_cast<char>(0x80 | ((Code >> 6) & 0x3f))); Out.push_back(static_cast<char>(0x80 | (Code & 0x3f))); }
|
||||
}
|
||||
bool Hex4(uint32& Out)
|
||||
bool Hex4(std::uint32_t& Out)
|
||||
{
|
||||
if (Position + 4 > Text.size()) return false;
|
||||
Out = 0;
|
||||
for (int32 I = 0; I < 4; ++I)
|
||||
for (std::int32_t I = 0; I < 4; ++I)
|
||||
{
|
||||
const char C = Text[Position++];
|
||||
const int32 N = (C >= '0' && C <= '9') ? C - '0' : (C >= 'a' && C <= 'f') ? C - 'a' + 10 : (C >= 'A' && C <= 'F') ? C - 'A' + 10 : -1;
|
||||
const std::int32_t N = (C >= '0' && C <= '9') ? C - '0' : (C >= 'a' && C <= 'f') ? C - 'a' + 10 : (C >= 'A' && C <= 'F') ? C - 'A' + 10 : -1;
|
||||
if (N < 0) return false;
|
||||
Out = (Out << 4) | static_cast<uint32>(N);
|
||||
Out = (Out << 4) | static_cast<std::uint32_t>(N);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -89,11 +99,11 @@ namespace VFJson
|
||||
case 'r': Out.push_back('\r'); break; case 't': Out.push_back('\t'); break;
|
||||
case 'u':
|
||||
{
|
||||
uint32 Code = 0; if (!Hex4(Code)) { Error = "invalid JSON unicode escape"; return false; }
|
||||
std::uint32_t Code = 0; if (!Hex4(Code)) { Error = "invalid JSON unicode escape"; return false; }
|
||||
if (Code >= 0xd800 && Code <= 0xdbff)
|
||||
{
|
||||
if (Position + 2 > Text.size() || Text[Position++] != '\\' || Text[Position++] != 'u') { Error = "missing JSON low surrogate"; return false; }
|
||||
uint32 Low = 0; if (!Hex4(Low) || Low < 0xdc00 || Low > 0xdfff) { Error = "invalid JSON low surrogate"; return false; }
|
||||
std::uint32_t Low = 0; if (!Hex4(Low) || Low < 0xdc00 || Low > 0xdfff) { Error = "invalid JSON low surrogate"; return false; }
|
||||
Code = 0x10000 + ((Code - 0xd800) << 10) + (Low - 0xdc00);
|
||||
}
|
||||
AppendUtf8(Out, Code); break;
|
||||
|
||||
Reference in new issue
Block a user