示例#1
0
        // 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());
            }
        }
示例#2
0
 public BittableHandleGenerator(TextTemplating.TextTransformation ttFile,
                                NumberCodeDefinition underlyingType, string structName)
     : this(ttFile, underlyingType.Code.ToString(), structName)
 {
     if (underlyingType == null)
     {
         throw new ArgumentNullException(nameof(underlyingType));
     }
 }
示例#3
0
        public static string GetVectorsSuffix(this NumberCodeDefinition def)
        {
            if (def == null)
            {
                throw new ArgumentNullException(nameof(def));
            }

            if (!def.IsByte)
            {
                return(GetConstantKeyword(def));
            }

            return("Bytes");
        }
示例#4
0
            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;
            }
示例#5
0
 protected BitUtilCodeGenerator(TextTemplating.TextTransformation ttFile, NumberCodeDefinition def)
 {
     File = ttFile;
     Def  = def;
 }
示例#6
0
 public VectorDef(NumberCodeDefinition codeDef, int dimensions)
 {
     CodeDef    = codeDef;
     Dimensions = dimensions;
 }
示例#7
0
 internal ByteSwapableIntegerDefinition(NumberCodeDefinition codeDef)
     : this(codeDef, codeDef.SizeOfInBits)
 {
 }
示例#8
0
 internal ByteSwapableIntegerDefinition(NumberCodeDefinition codeDef, int bitCount)
 {
     mCodeDef       = codeDef;
     mSizeOfInBits  = bitCount;
     mSizeOfInBytes = bitCount / kBitsPerByte;
 }
示例#9
0
 protected BitFondleCodeGenerator(TextTemplating.TextTransformation ttFile, NumberCodeDefinition def)
     : base(ttFile, def)
 {
 }
示例#10
0
 public FastBitCountCodeGenerator(TextTemplating.TextTransformation ttFile, NumberCodeDefinition def)
     : base(ttFile, def)
 {
 }
示例#11
0
 public BitReverseCodeGenerator(TextTemplating.TextTransformation ttFile, NumberCodeDefinition def)
     : base(ttFile, def)
 {
 }