mirror of
https://github.com/FEX-Emu/FEX.git
synced 2025-01-08 06:30:42 +00:00
Merge pull request #3494 from neobrain/fix_libfwd_float_as_int
Library Forwarding: Don't map float/double to fixed-size integers
This commit is contained in:
commit
4e269d8b80
@ -191,10 +191,10 @@ static std::array<uint8_t, 32> GetSha256(const std::string& function_name) {
|
||||
};
|
||||
|
||||
std::string GetTypeNameWithFixedSizeIntegers(clang::ASTContext& context, clang::QualType type) {
|
||||
if (type->isBuiltinType()) {
|
||||
if (type->isBuiltinType() && type->isIntegerType()) {
|
||||
auto size = context.getTypeSize(type);
|
||||
return fmt::format("uint{}_t", size);
|
||||
} else if (type->isPointerType() && type->getPointeeType()->isBuiltinType() && context.getTypeSize(type->getPointeeType()) > 8) {
|
||||
} else if (type->isPointerType() && type->getPointeeType()->isBuiltinType() && type->getPointeeType()->isIntegerType() && context.getTypeSize(type->getPointeeType()) > 8) {
|
||||
// TODO: Also apply this path to char-like types
|
||||
auto size = context.getTypeSize(type->getPointeeType());
|
||||
return fmt::format("uint{}_t*", size);
|
||||
|
@ -551,10 +551,10 @@ void GenerateThunkLibsAction::OnAnalysisComplete(clang::ASTContext& context) {
|
||||
}
|
||||
|
||||
auto get_guest_type_name = [this](clang::QualType type) {
|
||||
if (type->isBuiltinType() && !type->isFloatingType()) {
|
||||
if (type->isBuiltinType() && type->isIntegerType()) {
|
||||
auto size = guest_abi.at(type.getUnqualifiedType().getAsString()).get_if_simple_or_struct()->size_bits;
|
||||
return get_fixed_size_int_name(type.getTypePtr(), size);
|
||||
} else if (type->isPointerType() && type->getPointeeType()->isIntegerType() && !type->getPointeeType()->isEnumeralType() && !type->getPointeeType()->isVoidType()) {
|
||||
} else if (type->isPointerType() && type->getPointeeType()->isBuiltinType() && type->getPointeeType()->isIntegerType() && !type->getPointeeType()->isVoidType()) {
|
||||
auto size = guest_abi.at(type->getPointeeType().getUnqualifiedType().getAsString()).get_if_simple_or_struct()->size_bits;
|
||||
return fmt::format("{}{}*", type->getPointeeType().isConstQualified() ? "const " : "", get_fixed_size_int_name(type->getPointeeType().getTypePtr(), size));
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user