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

Unified Diff: third_party/libjpeg_turbo/jmemmgr.c

Issue 7554002: Updates libjpeg-turbo to 1.1.90 (r677) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/
Patch Set: '' Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/libjpeg_turbo/jerror.h ('k') | third_party/libjpeg_turbo/jmorecfg.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libjpeg_turbo/jmemmgr.c
===================================================================
--- third_party/libjpeg_turbo/jmemmgr.c (revision 95020)
+++ third_party/libjpeg_turbo/jmemmgr.c (working copy)
@@ -37,6 +37,15 @@
#endif
+LOCAL(size_t)
+round_up_pow2 (size_t a, size_t b)
+/* a rounded up to the next multiple of b, i.e. ceil(a/b)*b */
+/* Assumes a >= 0, b > 0, and b is a power of 2 */
+{
+ return ((a + b - 1) & (~(b - 1)));
+}
+
+
/*
* Some important notes:
* The allocation routines provided here must never return NULL.
@@ -265,7 +274,7 @@
* and so that algorithms can straddle outside the proper area up
* to the next alignment.
*/
- sizeofobject = jround_up(sizeofobject, ALIGN_SIZE);
+ sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
/* Check for unsatisfiable request (do now to ensure no overflow below) */
if ((SIZEOF(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) > MAX_ALLOC_CHUNK)
@@ -354,7 +363,7 @@
* algorithms can straddle outside the proper area up to the next
* alignment.
*/
- sizeofobject = jround_up(sizeofobject, ALIGN_SIZE);
+ sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
/* Check for unsatisfiable request (do now to ensure no overflow below) */
if ((SIZEOF(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) > MAX_ALLOC_CHUNK)
@@ -420,7 +429,7 @@
/* Make sure each row is properly aligned */
if ((ALIGN_SIZE % SIZEOF(JSAMPLE)) != 0)
out_of_memory(cinfo, 5); /* safety check */
- samplesperrow = (JDIMENSION)jround_up(samplesperrow, (2 * ALIGN_SIZE) / SIZEOF(JSAMPLE));
+ samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) / SIZEOF(JSAMPLE));
/* Calculate max # of rows allowed in one allocation chunk */
ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) /
« no previous file with comments | « third_party/libjpeg_turbo/jerror.h ('k') | third_party/libjpeg_turbo/jmorecfg.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698