private static void RestartModel(CPpmd7 p) { uint i, k, m; //memset(p.FreeList, 0, sizeof(p.FreeList)); for (i = 0; i < p.FreeList.Length; i++) { p.FreeList[i] = default(CPpmd_Void_Ref); } p.Text = p.Base + p.AlignOffset; p.HiUnit = p.Text + p.Size; p.LoUnit = p.UnitsStart = p.HiUnit - p.Size / 8 / UNIT_SIZE * 7 * UNIT_SIZE; p.GlueCount = 0; p.OrderFall = p.MaxOrder; p.RunLength = p.InitRL = -(Int32)((p.MaxOrder < 12) ? p.MaxOrder : 12) - 1; p.PrevSuccess = 0; p.MinContext = p.MaxContext = (CPpmd7_Context *)(p.HiUnit -= UNIT_SIZE); /* AllocContext(p); */ p.MinContext->Suffix = default(CPpmd7_Context_Ref); p.MinContext->NumStats = 256; p.MinContext->SummFreq = 256 + 1; p.FoundState = (CPpmd_State *)p.LoUnit; /* AllocUnits(p, PPMD_NUM_INDEXES - 1); */ p.LoUnit += U2B(256 / 2); p.MinContext->Stats = REF(p, p.FoundState); for (i = 0; i < 256; i++) { CPpmd_State *s = &p.FoundState[i]; s->Symbol = (byte)i; s->Freq = 1; SetSuccessor(s, default(CPpmd_Void_Ref)); } for (i = 0; i < 128; i++) { for (k = 0; k < 8; k++) { ushort *dest = p.BinSumm[i] + k; ushort val = (ushort)(PPMD_BIN_SCALE - kInitBinEsc[k] / (i + 2)); for (m = 0; m < 64; m += 8) { dest[m] = val; } } } for (i = 0; i < 25; i++) { for (k = 0; k < 16; k++) { CPpmd_See *s = &p.See[i][k]; s->Summ = (ushort)((5 * i + 10) << (s->Shift = PPMD_PERIOD_BITS - 4)); s->Count = 4; } } }
public CPpmd7() { #if NET_45 var kSeeSize = Marshal.SizeOf(typeof(CPpmd_See)); #else var kSeeSize = Marshal.SizeOf <CPpmd_See>(); #endif mBackingSee = Marshal.AllocCoTaskMem(kSeeSize * (25 * 16 + 1)); DummySee = (CPpmd_See *)mBackingSee; for (int i = 0; i < 25; i++) { See[i] = DummySee; DummySee += 16; } mBackingBinSumm = Marshal.AllocCoTaskMem(128 * 64 * 2); ushort *p = (ushort *)mBackingBinSumm; for (int i = 0; i < 128; i++) { BinSumm[i] = p; p += 64; } }
public CPpmd7() { var kSeeSize = Marshal.SizeOf(typeof(CPpmd_See)); mBackingSee = Marshal.AllocCoTaskMem(kSeeSize * (25 * 16 + 1)); DummySee = (CPpmd_See*)mBackingSee; for (int i = 0; i < 25; i++) { See[i] = DummySee; DummySee += 16; } mBackingBinSumm = Marshal.AllocCoTaskMem(128 * 64 * 2); ushort* p = (ushort*)mBackingBinSumm; for (int i = 0; i < 128; i++) { BinSumm[i] = p; p += 64; } }