mirror of
https://github.com/Wack0/IFPSTools.NET.git
synced 2025-06-18 10:45:36 -04:00

libifpscc: initial commit readme: document ifpscc/libifpscc license: add credits for ifpscc/libifpscc (derived from code also MIT licensed) libifps: make additional fields/types public for libifpscc libifps: fix field documentation for some opcodes libifps: fix loading functions that are not exported libifps: allow saving a nonexistant primitive type if the same primitive type was added already libifps: fix parsing Extended constants libifps: fix ushort/short being mapped to the wrong types in one table csproj: set Prefer32Bit=false for release builds
40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace ABT {
|
|
public class Utils {
|
|
|
|
// class StoreEntry
|
|
// ================
|
|
// the inner storage of entries
|
|
//
|
|
public class StoreEntry {
|
|
public StoreEntry(String name, ExprType type, Int32 offset, bool arg = false) {
|
|
this.name = name;
|
|
this.type = type;
|
|
this.offset = offset;
|
|
isArg = arg;
|
|
}
|
|
public readonly String name;
|
|
public readonly ExprType type;
|
|
public readonly Int32 offset;
|
|
public readonly bool isArg;
|
|
}
|
|
|
|
public static Int32 RoundUp(Int32 value, Int32 alignment) {
|
|
return (value + alignment - 1) & ~(alignment- 1);
|
|
}
|
|
|
|
public static Tuple<Int32, IReadOnlyList<Int32>> PackArguments(IReadOnlyList<ExprType> types) {
|
|
List<Int32> offsets = new List<Int32>();
|
|
Int32 offset = 0;
|
|
foreach (ExprType type in types) {
|
|
offsets.Add(offset);
|
|
offset++;
|
|
}
|
|
return new Tuple<Int32, IReadOnlyList<Int32>>(offset, offsets);
|
|
}
|
|
|
|
}
|
|
}
|