Blame util_math.h

Packit 631bab
/*
Packit 631bab
 * Copyright 2014 Advanced Micro Devices, Inc.
Packit 631bab
 *
Packit 631bab
 * Permission is hereby granted, free of charge, to any person obtaining a
Packit 631bab
 * copy of this software and associated documentation files (the "Software"),
Packit 631bab
 * to deal in the Software without restriction, including without limitation
Packit 631bab
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
Packit 631bab
 * and/or sell copies of the Software, and to permit persons to whom the
Packit 631bab
 * Software is furnished to do so, subject to the following conditions:
Packit 631bab
 *
Packit 631bab
 * The above copyright notice and this permission notice shall be included in
Packit 631bab
 * all copies or substantial portions of the Software.
Packit 631bab
 *
Packit 631bab
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Packit 631bab
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Packit 631bab
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
Packit 631bab
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
Packit 631bab
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
Packit 631bab
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Packit 631bab
 * OTHER DEALINGS IN THE SOFTWARE.
Packit 631bab
 *
Packit 631bab
*/
Packit 631bab
Packit 631bab
#ifndef _UTIL_MATH_H_
Packit 631bab
#define _UTIL_MATH_H_
Packit 631bab
Packit 631bab
#define MIN2( A, B )   ( (A)<(B) ? (A) : (B) )
Packit 631bab
#define MAX2( A, B )   ( (A)>(B) ? (A) : (B) )
Packit 631bab
#define MAX3( A, B, C ) ((A) > (B) ? MAX2(A, C) : MAX2(B, C))
Packit 631bab
Packit 631bab
#define __align_mask(value, mask)  (((value) + (mask)) & ~(mask))
Packit 631bab
#define ALIGN(value, alignment)    __align_mask(value, (__typeof__(value))((alignment) - 1))
Packit 631bab
Packit 631bab
#endif /*_UTIL_MATH_H_*/