#endif
#endif
+#ifndef av_pure
+#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0)
+# define av_pure __attribute__((pure))
+#else
+# define av_pure
+#endif
+#endif
+
+#ifndef av_const
+#if defined(__GNUC__) && (__GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ > 5)
+# define av_const __attribute__((const))
+#else
+# define av_const
+#endif
+#endif
+
#ifdef HAVE_AV_CONFIG_H
# include "internal.h"
#endif /* HAVE_AV_CONFIG_H */
/* misc math functions */
extern const uint8_t ff_log2_tab[256];
-static inline int av_log2(unsigned int v)
+static inline av_const int av_log2(unsigned int v)
{
int n = 0;
if (v & 0xffff0000) {
return n;
}
-static inline int av_log2_16bit(unsigned int v)
+static inline av_const int av_log2_16bit(unsigned int v)
{
int n = 0;
if (v & 0xff00) {
}
/* median of 3 */
-static inline int mid_pred(int a, int b, int c)
+static inline av_const int mid_pred(int a, int b, int c)
{
#ifdef HAVE_CMOV
int i=b;
* @param amax maximum value of the clip range
* @return clipped value
*/
-static inline int av_clip(int a, int amin, int amax)
+static inline av_const int av_clip(int a, int amin, int amax)
{
if (a < amin) return amin;
else if (a > amax) return amax;
* @param a value to clip
* @return clipped value
*/
-static inline uint8_t av_clip_uint8(int a)
+static inline av_const uint8_t av_clip_uint8(int a)
{
if (a&(~255)) return (-a)>>31;
else return a;
* @param a value to clip
* @return clipped value
*/
-static inline int16_t av_clip_int16(int a)
+static inline av_const int16_t av_clip_int16(int a)
{
if ((a+32768) & ~65535) return (a>>31) ^ 32767;
else return a;
}
/* math */
-int64_t ff_gcd(int64_t a, int64_t b);
+int64_t av_const ff_gcd(int64_t a, int64_t b);
/**
* converts fourcc string to int
*/
-static inline int ff_get_fourcc(const char *s){
+static inline av_pure int ff_get_fourcc(const char *s){
#ifdef HAVE_AV_CONFIG_H
assert( strlen(s)==4 );
#endif