Skip to content

Commit 5b0856d

Browse files
committed
avutil/internal: Remove unused ff_rint64_clip()
Signed-off-by: Andreas Rheinhardt <[email protected]>
1 parent 65f6851 commit 5b0856d

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

libavutil/internal.h

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -217,42 +217,6 @@ void avpriv_request_sample(void *avc,
217217
#define SUINT32 uint32_t
218218
#endif
219219

220-
/**
221-
* Clip and convert a double value into the long long amin-amax range.
222-
* This function is needed because conversion of floating point to integers when
223-
* it does not fit in the integer's representation does not necessarily saturate
224-
* correctly (usually converted to a cvttsd2si on x86) which saturates numbers
225-
* > INT64_MAX to INT64_MIN. The standard marks such conversions as undefined
226-
* behavior, allowing this sort of mathematically bogus conversions. This provides
227-
* a safe alternative that is slower obviously but assures safety and better
228-
* mathematical behavior.
229-
* @param a value to clip
230-
* @param amin minimum value of the clip range
231-
* @param amax maximum value of the clip range
232-
* @return clipped value
233-
*/
234-
static av_always_inline av_const int64_t ff_rint64_clip(double a, int64_t amin, int64_t amax)
235-
{
236-
int64_t res;
237-
#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
238-
if (amin > amax) abort();
239-
#endif
240-
// INT64_MAX+1,INT64_MIN are exactly representable as IEEE doubles
241-
// do range checks first
242-
if (a >= 9223372036854775808.0)
243-
return amax;
244-
if (a <= -9223372036854775808.0)
245-
return amin;
246-
247-
// safe to call llrint and clip accordingly
248-
res = llrint(a);
249-
if (res > amax)
250-
return amax;
251-
if (res < amin)
252-
return amin;
253-
return res;
254-
}
255-
256220
/**
257221
* A wrapper for open() setting O_CLOEXEC.
258222
*/

0 commit comments

Comments
 (0)