2004-07-16 04:46:01 +04:00
|
|
|
/*
|
|
|
|
Copyright (c) 2002/03, Thomas Kurschel
|
2010-11-25 02:42:17 +03:00
|
|
|
|
2004-07-16 04:46:01 +04:00
|
|
|
|
|
|
|
Part of Radeon accelerant
|
2010-11-25 02:42:17 +03:00
|
|
|
|
2004-07-16 04:46:01 +04:00
|
|
|
Utility functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _UTILS_H
|
|
|
|
#define _UTILS_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2010-11-25 02:42:17 +03:00
|
|
|
extern int radeon_log2( uint32 x );
|
2004-07-16 04:46:01 +04:00
|
|
|
|
|
|
|
static inline int RoundDiv( int num, int den )
|
|
|
|
{
|
|
|
|
return (num + (den / 2)) / den;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int32 RoundDiv64( int64 num, int32 den )
|
|
|
|
{
|
|
|
|
return (num + (den / 2)) / den;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int ceilShiftDiv( int num, int shift )
|
|
|
|
{
|
|
|
|
return (num + (1 << shift) - 1) >> shift;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int ceilDiv( int num, int den )
|
|
|
|
{
|
|
|
|
return (num + den - 1) / den;
|
|
|
|
}
|
|
|
|
|
|
|
|
// macros for fixed-point calculation
|
|
|
|
#define FIX_SHIFT 32
|
|
|
|
#define FIX_SCALE (1LL << FIX_SHIFT)
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|