public OffsetTable(ushort numOfTables) { this.sfntversion = (FIXED)0x00010000; this.numTables = (USHORT)numOfTables; // searchRange, entrySelector の計算 numOfTables >>= 1; ushort srange = 0x10; ushort eselect = 0; while (numOfTables != 0) { numOfTables >>= 1; srange <<= 1; eselect++; } this.searchRange = (USHORT)srange; this.entrySelector = (USHORT)eselect; this.rangeShift = (USHORT)((ushort)this.numTables * (int)16 - srange); }
public static extern USHORT htons([In] USHORT hostshort);