2015-05-08 02:41:33 +03:00
|
|
|
/*
|
2016-09-02 00:32:49 +03:00
|
|
|
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
|
2015-05-08 02:41:33 +03:00
|
|
|
*
|
2016-09-02 00:32:49 +03:00
|
|
|
* This source code is subject to the terms of the BSD 2 Clause License and
|
|
|
|
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
|
|
|
* was not distributed with this source code in the LICENSE file, you can
|
|
|
|
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
|
|
|
* Media Patent License 1.0 was not distributed with this source code in the
|
|
|
|
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
2015-05-08 02:41:33 +03:00
|
|
|
*/
|
|
|
|
|
2016-08-31 00:01:10 +03:00
|
|
|
#ifndef AOM_PORTS_MSVC_H_
|
|
|
|
#define AOM_PORTS_MSVC_H_
|
2015-05-08 02:41:33 +03:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
|
2016-08-31 00:01:10 +03:00
|
|
|
#include "./aom_config.h"
|
2015-05-08 02:41:33 +03:00
|
|
|
|
2016-08-11 04:23:43 +03:00
|
|
|
#if _MSC_VER < 1900 // VS2015 provides snprintf
|
|
|
|
#define snprintf _snprintf
|
|
|
|
#endif // _MSC_VER < 1900
|
2015-05-08 02:41:33 +03:00
|
|
|
|
2015-08-08 04:27:48 +03:00
|
|
|
#if _MSC_VER < 1800 // VS2013 provides round
|
2015-08-08 21:11:23 +03:00
|
|
|
#include <math.h>
|
2015-08-08 04:27:48 +03:00
|
|
|
static INLINE double round(double x) {
|
|
|
|
if (x < 0)
|
|
|
|
return ceil(x - 0.5);
|
|
|
|
else
|
|
|
|
return floor(x + 0.5);
|
|
|
|
}
|
2016-04-08 01:16:30 +03:00
|
|
|
|
|
|
|
static INLINE float roundf(float x) {
|
|
|
|
if (x < 0)
|
|
|
|
return (float)ceil(x - 0.5f);
|
|
|
|
else
|
|
|
|
return (float)floor(x + 0.5f);
|
|
|
|
}
|
|
|
|
|
|
|
|
static INLINE long lroundf(float x) {
|
|
|
|
if (x < 0)
|
|
|
|
return (long)(x - 0.5f);
|
|
|
|
else
|
|
|
|
return (long)(x + 0.5f);
|
|
|
|
}
|
2015-08-08 04:27:48 +03:00
|
|
|
#endif // _MSC_VER < 1800
|
|
|
|
|
2015-05-08 02:41:33 +03:00
|
|
|
#endif // _MSC_VER
|
2016-08-31 00:01:10 +03:00
|
|
|
#endif // AOM_PORTS_MSVC_H_
|