| OLD | NEW |
| 1 /* | 1 /* |
| 2 * jutils.c | 2 * jutils.c |
| 3 * | 3 * |
| 4 * Copyright (C) 1991-1996, Thomas G. Lane. | 4 * Copyright (C) 1991-1996, Thomas G. Lane. |
| 5 * This file is part of the Independent JPEG Group's software. | 5 * This file is part of the Independent JPEG Group's software. |
| 6 * For conditions of distribution and use, see the accompanying README file. | 6 * For conditions of distribution and use, see the accompanying README file. |
| 7 * | 7 * |
| 8 * This file contains tables and miscellaneous utility routines needed | 8 * This file contains tables and miscellaneous utility routines needed |
| 9 * for both compression and decompression. | 9 * for both compression and decompression. |
| 10 * Note we prefix all global names with "j" to minimize conflicts with | 10 * Note we prefix all global names with "j" to minimize conflicts with |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 GLOBAL(long) | 71 GLOBAL(long) |
| 72 jdiv_round_up (long a, long b) | 72 jdiv_round_up (long a, long b) |
| 73 /* Compute a/b rounded up to next integer, ie, ceil(a/b) */ | 73 /* Compute a/b rounded up to next integer, ie, ceil(a/b) */ |
| 74 /* Assumes a >= 0, b > 0 */ | 74 /* Assumes a >= 0, b > 0 */ |
| 75 { | 75 { |
| 76 return (a + b - 1L) / b; | 76 return (a + b - 1L) / b; |
| 77 } | 77 } |
| 78 | 78 |
| 79 | 79 |
| 80 GLOBAL(size_t) | 80 GLOBAL(long) |
| 81 jround_up (size_t a, size_t b) | 81 jround_up (long a, long b) |
| 82 /* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */ | 82 /* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */ |
| 83 /* Assumes a >= 0, b > 0 */ | 83 /* Assumes a >= 0, b > 0 */ |
| 84 { | 84 { |
| 85 a += b - 1L; | 85 a += b - 1L; |
| 86 return a - (a % b); | 86 return a - (a % b); |
| 87 } | 87 } |
| 88 | 88 |
| 89 | 89 |
| 90 /* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays | 90 /* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays |
| 91 * and coefficient-block arrays. This won't work on 80x86 because the arrays | 91 * and coefficient-block arrays. This won't work on 80x86 because the arrays |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 FMEMZERO(target, bytestozero); | 170 FMEMZERO(target, bytestozero); |
| 171 #else | 171 #else |
| 172 register char FAR * ptr = (char FAR *) target; | 172 register char FAR * ptr = (char FAR *) target; |
| 173 register size_t count; | 173 register size_t count; |
| 174 | 174 |
| 175 for (count = bytestozero; count > 0; count--) { | 175 for (count = bytestozero; count > 0; count--) { |
| 176 *ptr++ = 0; | 176 *ptr++ = 0; |
| 177 } | 177 } |
| 178 #endif | 178 #endif |
| 179 } | 179 } |
| OLD | NEW |