GLOBAL(long)
jdiv_round_up (long a, long b) /* Compute a/b rounded up to next integer, ie, ceil(a/b) */ /* Assumes a >= 0, b > 0 */
{ return (a + b - 1L) / b;
}
GLOBAL(long)
jround_up (long a, long b) /* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */ /* Assumes a >= 0, b > 0 */
{
a += b - 1L; return a - (a % b);
}
/* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays *andcoefficient-blockarrays.Thiswon'tworkon80x86becausethearrays *areFARandwe'reassumingasmall-pointermemorymodel.However,some *DOScompilersprovidefar-pointerversionsofmemcpy()andmemset()even *inthesmall-modellibraries.ThesewillbeusedifUSE_FMEMisdefined. *Otherwise,theroutinesbelowdoitthehardway.(Theperformancecost *isnotallthatgreat,becausetheseroutinesaren'tveryheavilyused.)
*/
#ifndef NEED_FAR_POINTERS /* normal case, same as regular macros */ #define FMEMCOPY(dest,src,size) MEMCOPY(dest,src,size) #define FMEMZERO(target,size) MEMZERO(target,size) #else/* 80x86 case, define if we can */ #ifdef USE_FMEM #define FMEMCOPY(dest,src,size) _fmemcpy((void FAR *)(dest), (constvoid FAR *)(src), (size_t)(size)) #define FMEMZERO(target,size) _fmemset((void FAR *)(target), 0, (size_t)(size)) #endif #endif
GLOBAL(void)
jcopy_sample_rows (JSAMPARRAY input_array, int source_row,
JSAMPARRAY output_array, int dest_row, int num_rows, JDIMENSION num_cols) /* Copy some rows of samples from one place to another. *num_rowsrowsarecopiedfrominput_array[source_row++] *tooutput_array[dest_row++];theseareasmayoverlapforduplication. *Thesourceanddestinationarraysmustbeatleastaswideasnum_cols.
*/
{ register JSAMPROW inptr, outptr; #ifdef FMEMCOPY register size_t count = (size_t) (num_cols * SIZEOF(JSAMPLE)); #else register JDIMENSION count; #endif registerint row;
GLOBAL(void)
jzero_far (void FAR * target, size_t bytestozero) /* Zero out a chunk of FAR memory. */ /* This might be sample-array data, block-array data, or alloc_large data. */
{ #ifdef FMEMZERO
FMEMZERO(target, bytestozero); #else registerchar FAR * ptr = (char FAR *) target; register size_t count;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.