packF4() public static method

public static packF4 ( byte arr, int offs, float val ) : void
arr byte
offs int
val float
return void
Example #1
0
        internal void pack(Page pg, int i)
        {
            byte[] dst = pg.data;
            switch (key.type)
            {
            case ClassDescriptor.FieldType.tpBoolean:
            case ClassDescriptor.FieldType.tpSByte:
            case ClassDescriptor.FieldType.tpByte:
                dst[OldBtreePage.firstKeyOffs + i] = (byte)key.ival;
                break;

            case ClassDescriptor.FieldType.tpShort:
            case ClassDescriptor.FieldType.tpUShort:
            case ClassDescriptor.FieldType.tpChar:
                Bytes.pack2(dst, OldBtreePage.firstKeyOffs + i * 2, (short)key.ival);
                break;

            case ClassDescriptor.FieldType.tpInt:
            case ClassDescriptor.FieldType.tpUInt:
            case ClassDescriptor.FieldType.tpEnum:
            case ClassDescriptor.FieldType.tpObject:
            case ClassDescriptor.FieldType.tpOid:
                Bytes.pack4(dst, OldBtreePage.firstKeyOffs + i * 4, key.ival);
                break;

            case ClassDescriptor.FieldType.tpLong:
            case ClassDescriptor.FieldType.tpULong:
            case ClassDescriptor.FieldType.tpDate:
                Bytes.pack8(dst, OldBtreePage.firstKeyOffs + i * 8, key.lval);
                break;

            case ClassDescriptor.FieldType.tpFloat:
                Bytes.packF4(dst, OldBtreePage.firstKeyOffs + i * 4, (float)key.dval);
                break;

            case ClassDescriptor.FieldType.tpDouble:
                Bytes.packF8(dst, OldBtreePage.firstKeyOffs + i * 8, key.dval);
                break;

            case ClassDescriptor.FieldType.tpDecimal:
                Bytes.packDecimal(dst, OldBtreePage.firstKeyOffs + i * 16, key.dec);
                break;

            case ClassDescriptor.FieldType.tpGuid:
                Bytes.packGuid(dst, OldBtreePage.firstKeyOffs + i * 16, key.guid);
                break;


            default:
                Debug.Assert(false, "Invalid type");
                break;
            }
            Bytes.pack4(dst, OldBtreePage.firstKeyOffs + (OldBtreePage.maxItems - i - 1) * 4, oid);
        }
Example #2
0
 public int packF4(int offs, float val)
 {
     extend(offs + 4);
     Bytes.packF4(arr, offs, val);
     return offs + 4;
 }