2010-09-20 01:19:40 +02:00
|
|
|
/*
|
|
|
|
* util.h
|
|
|
|
*
|
|
|
|
* Copyright 2008 kilo aka Gabor Kmetyko <kg.kilo@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
2010-10-23 23:35:59 +02:00
|
|
|
#ifndef SRC_DRIVERS_KILO2008_UTIL_H_
|
|
|
|
#define SRC_DRIVERS_KILO2008_UTIL_H_
|
2010-09-20 01:19:40 +02:00
|
|
|
|
|
|
|
extern double Mag(const double x, const double y);
|
|
|
|
extern bool BetweenStrict(const double val, const double min, const double max);
|
|
|
|
extern bool BetweenLoose(const double val, const double min, const double max);
|
|
|
|
extern double sign(const double d);
|
|
|
|
|
2011-05-29 10:58:33 +02:00
|
|
|
#if 0 // doesn't compile in Vis Studio 2010
|
2010-10-23 23:35:59 +02:00
|
|
|
// until nullptr is defined...
|
|
|
|
const class { // this is a const object...
|
|
|
|
public:
|
|
|
|
template<class T> // convertible to any type
|
|
|
|
operator T*() const // of null non-member
|
|
|
|
{ return 0; } // pointer...
|
|
|
|
template<class C, class T> // or any type of null
|
|
|
|
operator T C::*() const // member pointer...
|
|
|
|
{ return 0; }
|
|
|
|
private: // whose address can't be taken
|
|
|
|
void operator&() const; // NOLINT(runtime/operator)
|
|
|
|
} nullptr = {}; // and whose name is nullptr
|
2011-05-29 10:58:33 +02:00
|
|
|
#endif
|
2010-10-23 23:35:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // SRC_DRIVERS_KILO2008_UTIL_H_
|