MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / nonCompressableRun

Method nonCompressableRun

src/jrd/sqz.cpp:68–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66};
67
68unsigned Compressor::nonCompressableRun(unsigned length)
69{
70 fb_assert(length && length <= MAX_NONCOMP_RUN);
71
72 auto result = length;
73
74 // If the prior run was also non-compressable and it wasn't fully utilized,
75 // merge our run there. Otherwise, create a new run.
76
77 if (m_runs.hasData() && m_runs.back() > 0 && m_runs.back() < MAX_NONCOMP_RUN)
78 {
79 const auto max = MIN(MAX_NONCOMP_RUN - m_runs.back(), length);
80 length -= max;
81 m_runs.back() += max;
82 }
83
84 if (length)
85 {
86 m_runs.add(length);
87 result++;
88 }
89
90 fb_assert(m_runs.back() > 0 && m_runs.back() <= MAX_NONCOMP_RUN);
91
92 return result;
93}
94
95Compressor::Compressor(thread_db* tdbb, ULONG length, const UCHAR* data)
96 : Compressor(

Callers

nothing calls this directly

Calls 3

hasDataMethod · 0.45
backMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected