summaryrefslogtreecommitdiff
path: root/src/lib/openmj2/int.h
diff options
context:
space:
mode:
authorAntonin Descampe <antonin@gmail.com>2016-01-25 23:22:06 +0100
committerAntonin Descampe <antonin@gmail.com>2016-01-25 23:22:06 +0100
commit0febbff19e05cb1a6c2613eee76ad46a669c96cd (patch)
treeb6442d01348e2ba6404d0fd6abcc4eb6d6cc1390 /src/lib/openmj2/int.h
parentbede1568b197021bb576b935422af6c1d0a79e21 (diff)
processed all c/h files through astyle with opj_astyle.cfgcodingstyle
Diffstat (limited to 'src/lib/openmj2/int.h')
-rw-r--r--src/lib/openmj2/int.h64
1 files changed, 36 insertions, 28 deletions
diff --git a/src/lib/openmj2/int.h b/src/lib/openmj2/int.h
index 07f60c31..9a9ce787 100644
--- a/src/lib/openmj2/int.h
+++ b/src/lib/openmj2/int.h
@@ -1,6 +1,6 @@
/*
- * The copyright in this software is being made available under the 2-clauses
- * BSD License, included below. This software may be subject to other third
+ * The copyright in this software is being made available under the 2-clauses
+ * BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@@ -8,7 +8,7 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
- * Copyright (c) 2003-2007, Francois-Olivier Devaux
+ * Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
@@ -53,15 +53,17 @@ The functions in INT.H have for goal to realize operations on integers.
Get the minimum of two integers
@return Returns a if a < b else b
*/
-static INLINE int int_min(int a, int b) {
- return a < b ? a : b;
+static INLINE int int_min(int a, int b)
+{
+ return a < b ? a : b;
}
/**
Get the maximum of two integers
@return Returns a if a > b else b
*/
-static INLINE int int_max(int a, int b) {
- return (a > b) ? a : b;
+static INLINE int int_max(int a, int b)
+{
+ return (a > b) ? a : b;
}
/**
Clamp an integer inside an interval
@@ -69,53 +71,59 @@ Clamp an integer inside an interval
<ul>
<li>Returns a if (min < a < max)
<li>Returns max if (a > max)
-<li>Returns min if (a < min)
+<li>Returns min if (a < min)
</ul>
*/
-static INLINE int int_clamp(int a, int min, int max) {
- if (a < min)
- return min;
- if (a > max)
- return max;
- return a;
+static INLINE int int_clamp(int a, int min, int max)
+{
+ if (a < min)
+ return min;
+ if (a > max)
+ return max;
+ return a;
}
/**
@return Get absolute value of integer
*/
-static INLINE int int_abs(int a) {
- return a < 0 ? -a : a;
+static INLINE int int_abs(int a)
+{
+ return a < 0 ? -a : a;
}
/**
Divide an integer and round upwards
@return Returns a divided by b
*/
-static INLINE int int_ceildiv(int a, int b) {
- return (a + b - 1) / b;
+static INLINE int int_ceildiv(int a, int b)
+{
+ return (a + b - 1) / b;
}
/**
Divide an integer by a power of 2 and round upwards
@return Returns a divided by 2^b
*/
-static INLINE int int_ceildivpow2(int a, int b) {
- return (a + (1 << b) - 1) >> b;
+static INLINE int int_ceildivpow2(int a, int b)
+{
+ return (a + (1 << b) - 1) >> b;
}
/**
Divide an integer by a power of 2 and round downwards
@return Returns a divided by 2^b
*/
-static INLINE int int_floordivpow2(int a, int b) {
- return a >> b;
+static INLINE int int_floordivpow2(int a, int b)
+{
+ return a >> b;
}
/**
Get logarithm of an integer and round downwards
@return Returns log2(a)
*/
-static INLINE int int_floorlog2(int a) {
- int l;
- for (l = 0; a > 1; l++) {
- a >>= 1;
- }
- return l;
+static INLINE int int_floorlog2(int a)
+{
+ int l;
+ for (l = 0; a > 1; l++) {
+ a >>= 1;
+ }
+ return l;
}
/* ----------------------------------------------------------------------- */
/*@}*/