1a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik/* 2a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik * Copyright (C) 2013 The Android Open Source Project 3a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik * 4a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik * Licensed under the Apache License, Version 2.0 (the "License"); 5a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik * you may not use this file except in compliance with the License. 6a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik * You may obtain a copy of the License at 7a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik * 8a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik * http://www.apache.org/licenses/LICENSE-2.0 9a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik * 10a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik * Unless required by applicable law or agreed to in writing, software 11a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik * distributed under the License is distributed on an "AS IS" BASIS, 12a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik * See the License for the specific language governing permissions and 14a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik * limitations under the License. 15a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik */ 16a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik 17a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik#ifndef MATH_H_ 18a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik#define MATH_H_ 19a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik 20a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik#define max(a,b) \ 21a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik ({ __typeof__ (a) _a = (a); \ 22a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik __typeof__ (b) _b = (b); \ 23a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik _a > _b ? _a : _b; }) 24a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik 25a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik#define min(a,b) \ 26a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik ({ __typeof__ (a) _a = (a); \ 27a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik __typeof__ (b) _b = (b); \ 28a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik _a < _b ? _a : _b; }) 29a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik 30a1265c3d8a20e805e0c45083d5c7d728d4b70009Chris Craik#endif /* MATH_H_ */ 31