Lines Matching refs:index
99 static inline int do_clamp(int index, unsigned max)
104 if (index > (int)max)
105 index = max;
106 if (index < 0)
107 index = 0;
109 if ((unsigned)index > max)
111 if (index < 0)
112 index = 0;
114 index = max;
117 return index;
120 static inline int do_repeat_mod(int index, unsigned max)
124 if ((unsigned)index > max)
126 if (index < 0)
127 index = max - (~index % (max + 1));
129 index = index % (max + 1);
131 return index;
134 static inline int do_repeat_pow2(int index, unsigned max)
138 return index & max;
141 static inline int do_mirror_mod(int index, unsigned max)
148 index ^= index >> 31;
150 if ((unsigned)index > max)
153 index = index % mod;
154 if ((unsigned)index > max)
155 index = mod - index - 1;
157 return index;
160 static inline int do_mirror_pow2(int index, unsigned max)
164 int s = (index & (max + 1)) - 1;
167 return (index ^ s) & max;