Browse Source

Added int128 and uint128 to the marshalling structures in the C# generator. (#858)

fixed #771
pull/859/head
Kimon Topouzidis 8 years ago committed by Dimitar Dobrev
parent
commit
24e452a183
  1. 4
      src/Generator/Generators/CSharp/CSharpSources.cs
  2. 6
      src/Generator/Generators/CSharp/CSharpTypePrinter.cs

4
src/Generator/Generators/CSharp/CSharpSources.cs

@ -615,10 +615,6 @@ namespace CppSharp.Generators.CSharp @@ -615,10 +615,6 @@ namespace CppSharp.Generators.CSharp
var coreType = field.QualifiedType.Type.Desugar();
if (arrayType != null && arrayType.SizeType == ArrayType.ArraySize.Constant)
coreType = arrayType.Type.Desugar();
// we do not support the primitives below yet because their representation in C# is problematic
if (coreType.IsPrimitiveType(PrimitiveType.Int128) ||
coreType.IsPrimitiveType(PrimitiveType.UInt128))
return;
TypePrinterResult retType = TypePrinter.VisitFieldDecl(
new Field { Name = field.Name, QualifiedType = field.QualifiedType });

6
src/Generator/Generators/CSharp/CSharpTypePrinter.cs

@ -512,8 +512,10 @@ namespace CppSharp.Generators.CSharp @@ -512,8 +512,10 @@ namespace CppSharp.Generators.CSharp
case PrimitiveType.LongLong:
case PrimitiveType.ULongLong:
return GetIntString(primitive, Context.TargetInfo);
case PrimitiveType.Int128: return "__int128";
case PrimitiveType.UInt128: return "__uint128_t";
case PrimitiveType.Int128: return new TypePrinterResult { Type = "fixed byte",
NameSuffix = "[16]"}; // The type is always 128 bits wide
case PrimitiveType.UInt128: return new TypePrinterResult { Type = "fixed byte",
NameSuffix = "[16]"}; // The type is always 128 bits wide
case PrimitiveType.Half: return new TypePrinterResult { Type = "fixed byte",
NameSuffix = $"[{Context.TargetInfo.HalfWidth}]"};
case PrimitiveType.Float: return "float";

Loading…
Cancel
Save