Lines Matching +full:write +full:- +full:back
1 // SPDX-License-Identifier: 0BSD
24 // 0 = Byte-by-byte copying only.
25 // 1 = Use memcpy() for non-overlapping copies.
26 // 2 = Use x86 SSE2 for non-overlapping copies.
38 /// Byte-by-byte and memcpy() copy exactly the amount needed. Other methods
59 /// the oldest byte still in the dictionary and the current write
64 /// so that extra copying done by dict_repeat() won't write or read past
85 /// Write position in dictionary. The next byte will be written to
94 /// Write limit
100 /// "size - 2 * LZ_DICT_REPEAT_MAX".
121 /// Data specific to the LZ-based decoder
171 return dict->buf[dict->pos - distance - 1 in dict_get()
172 + (distance < dict->pos in dict_get()
173 ? 0 : dict->size - LZ_DICT_REPEAT_MAX)]; in dict_get()
181 return dict->buf[dict->pos - 1]; in dict_get0()
189 return dict->full == 0; in dict_is_empty()
197 return dict->full > distance; in dict_is_distance_valid()
206 // Don't write past the end of the dictionary. in dict_repeat()
207 const size_t dict_avail = dict->limit - dict->pos; in dict_repeat()
209 *len -= left; in dict_repeat()
211 size_t back = dict->pos - distance - 1; in dict_repeat() local
212 if (distance >= dict->pos) in dict_repeat()
213 back += dict->size - LZ_DICT_REPEAT_MAX; in dict_repeat()
216 // Minimal byte-by-byte method. This might be the least bad choice in dict_repeat()
218 while (left-- > 0) { in dict_repeat()
219 dict->buf[dict->pos++] = dict->buf[back++]; in dict_repeat()
230 dict->buf[dict->pos++] = dict->buf[back++]; in dict_repeat()
231 } while (--left > 0); in dict_repeat()
234 memcpy(dict->buf + dict->pos, dict->buf + back, left); in dict_repeat()
235 dict->pos += left; in dict_repeat()
240 size_t pos = dict->pos; in dict_repeat()
241 dict->pos += left; in dict_repeat()
244 (__m128i *)(dict->buf + back)); in dict_repeat()
246 (__m128i *)(dict->buf + back + 16)); in dict_repeat()
247 back += 32; in dict_repeat()
249 (__m128i *)(dict->buf + pos), x0); in dict_repeat()
251 (__m128i *)(dict->buf + pos + 16), x1); in dict_repeat()
253 } while (pos < dict->pos); in dict_repeat()
262 if (!dict->has_wrapped) in dict_repeat()
263 dict->full = dict->pos - LZ_DICT_INIT_POS; in dict_repeat()
272 dict->buf[dict->pos++] = byte; in dict_put()
274 if (!dict->has_wrapped) in dict_put()
275 dict->full = dict->pos - LZ_DICT_INIT_POS; in dict_put()
284 if (unlikely(dict->pos == dict->limit)) in dict_put_safe()
305 if (in_size - *in_pos > *left) in dict_write()
308 *left -= lzma_bufcpy(in, in_pos, in_size, in dict_write()
309 dict->buf, &dict->pos, dict->limit); in dict_write()
311 if (!dict->has_wrapped) in dict_write()
312 dict->full = dict->pos - LZ_DICT_INIT_POS; in dict_write()
321 dict->need_reset = true; in dict_reset()