Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1282)

Side by Side Diff: src/liblzma/lzma/lzma2_encoder.c

Issue 7109015: Update XZ Utils to 5.0.3 (in deps) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/xz/
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/liblzma/lzma/lzma2_decoder.c ('k') | src/liblzma/lzma/lzma_decoder.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /////////////////////////////////////////////////////////////////////////////// 1 ///////////////////////////////////////////////////////////////////////////////
2 // 2 //
3 /// \file lzma2_encoder.c 3 /// \file lzma2_encoder.c
4 /// \brief LZMA2 encoder 4 /// \brief LZMA2 encoder
5 /// 5 ///
6 // Authors: Igor Pavlov 6 // Authors: Igor Pavlov
7 // Lasse Collin 7 // Lasse Collin
8 // 8 //
9 // This file has been put into the public domain. 9 // This file has been put into the public domain.
10 // You can do whatever you want with this file. 10 // You can do whatever you want with this file.
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 return sizeof(lzma_coder) + lzma_mem; 367 return sizeof(lzma_coder) + lzma_mem;
368 } 368 }
369 369
370 370
371 extern lzma_ret 371 extern lzma_ret
372 lzma_lzma2_props_encode(const void *options, uint8_t *out) 372 lzma_lzma2_props_encode(const void *options, uint8_t *out)
373 { 373 {
374 const lzma_options_lzma *const opt = options; 374 const lzma_options_lzma *const opt = options;
375 uint32_t d = my_max(opt->dict_size, LZMA_DICT_SIZE_MIN); 375 uint32_t d = my_max(opt->dict_size, LZMA_DICT_SIZE_MIN);
376 376
377 » // Round up to to the next 2^n - 1 or 2^n + 2^(n - 1) - 1 depending 377 » // Round up to the next 2^n - 1 or 2^n + 2^(n - 1) - 1 depending
378 // on which one is the next: 378 // on which one is the next:
379 --d; 379 --d;
380 d |= d >> 2; 380 d |= d >> 2;
381 d |= d >> 3; 381 d |= d >> 3;
382 d |= d >> 4; 382 d |= d >> 4;
383 d |= d >> 8; 383 d |= d >> 8;
384 d |= d >> 16; 384 d |= d >> 16;
385 385
386 // Get the highest two bits using the proper encoding: 386 // Get the highest two bits using the proper encoding:
387 if (d == UINT32_MAX) 387 if (d == UINT32_MAX)
388 out[0] = 40; 388 out[0] = 40;
389 else 389 else
390 out[0] = get_pos_slot(d + 1) - 24; 390 out[0] = get_pos_slot(d + 1) - 24;
391 391
392 return LZMA_OK; 392 return LZMA_OK;
393 } 393 }
OLDNEW
« no previous file with comments | « src/liblzma/lzma/lzma2_decoder.c ('k') | src/liblzma/lzma/lzma_decoder.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698