// Get the keyword used to define general constants for integer types (bit count, etc) public static string GetConstantKeyword(this NumberCodeDefinition def) { if (def == null) { throw new ArgumentNullException(nameof(def)); } switch (def.Code) { case TypeCode.Byte: case TypeCode.SByte: return("Byte"); case TypeCode.UInt16: case TypeCode.Int16: return("Int16"); case TypeCode.UInt32: case TypeCode.Int32: return("Int32"); case TypeCode.UInt64: case TypeCode.Int64: return("Int64"); default: throw new InvalidOperationException(def.Code.ToString()); } }
public BittableHandleGenerator(TextTemplating.TextTransformation ttFile, NumberCodeDefinition underlyingType, string structName) : this(ttFile, underlyingType.Code.ToString(), structName) { if (underlyingType == null) { throw new ArgumentNullException(nameof(underlyingType)); } }
public static string GetVectorsSuffix(this NumberCodeDefinition def) { if (def == null) { throw new ArgumentNullException(nameof(def)); } if (!def.IsByte) { return(GetConstantKeyword(def)); } return("Bytes"); }
readonly string mOffsetName; // NOTE: offset variable must be mutable! internal IntegerByteAccessCodeGenerator(TextTemplating.TextTransformation ttFile, NumberCodeDefinition def, string byteName, string bufferName, string offsetName = null, int bitCount = -1) { mFile = ttFile; //mDef = def; mSizeOfInBits = bitCount == -1 ? def.SizeOfInBits : bitCount; mSizeOfInBytes = bitCount == -1 ? def.SizeOfInBytes : bitCount / kBitsPerByte; mByteName = byteName; mBufferName = bufferName; mOffsetName = offsetName; }
protected BitUtilCodeGenerator(TextTemplating.TextTransformation ttFile, NumberCodeDefinition def) { File = ttFile; Def = def; }
public VectorDef(NumberCodeDefinition codeDef, int dimensions) { CodeDef = codeDef; Dimensions = dimensions; }
internal ByteSwapableIntegerDefinition(NumberCodeDefinition codeDef) : this(codeDef, codeDef.SizeOfInBits) { }
internal ByteSwapableIntegerDefinition(NumberCodeDefinition codeDef, int bitCount) { mCodeDef = codeDef; mSizeOfInBits = bitCount; mSizeOfInBytes = bitCount / kBitsPerByte; }
protected BitFondleCodeGenerator(TextTemplating.TextTransformation ttFile, NumberCodeDefinition def) : base(ttFile, def) { }
public FastBitCountCodeGenerator(TextTemplating.TextTransformation ttFile, NumberCodeDefinition def) : base(ttFile, def) { }
public BitReverseCodeGenerator(TextTemplating.TextTransformation ttFile, NumberCodeDefinition def) : base(ttFile, def) { }