Image Interpolation with Contour Stencils
|
Memory management, portable types, math constants, and timing. More...
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
Go to the source code of this file.
Macros | |
#define | Malloc(s) MallocWithErrorMessage(s) |
Function to allocate a block of memory. More... | |
#define | Realloc(p, s) ReallocWithErrorMessage(p, s) |
Function to reallocate a block of memory. More... | |
#define | Free(p) free(p) |
Function to free memory. More... | |
#define | M_2PI 6.28318530717958647692528676655900576 |
The constant 2 pi. More... | |
#define | M_PI 3.14159265358979323846264338327950288 |
The constant pi. More... | |
#define | M_PI_2 1.57079632679489661923132169163975144 |
The constant pi/2. More... | |
#define | M_PI_4 0.78539816339744830961566084581987572 |
The constant pi/4. More... | |
#define | M_PI_8 0.39269908169872415480783042290993786 |
The constant pi/8. More... | |
#define | M_SQRT2 1.41421356237309504880168872420969808 |
The constant sqrt(2) More... | |
#define | M_1_SQRT2 0.70710678118654752440084436210484904 |
The constant 1/sqrt(2) More... | |
#define | M_E 2.71828182845904523536028747135266250 |
The natural number. More... | |
#define | M_LOG2E 1.44269504088896340735992468100189213 |
Log base 2 of the natural number. More... | |
#define | M_LOG10E 0.43429448190325182765112891891660508 |
Log base 10 of the natural number. More... | |
#define | M_LN2 0.69314718055994530941723212145817657 |
Natural log of 2. More... | |
#define | M_LN10 2.30258509299404568401799145468436421 |
Natural log of 10. More... | |
#define | M_EULER 0.57721566490153286060651209008240243 |
Euler number. More... | |
#define | M_SQRT2PI 2.50662827463100050241576528481104525 |
The constant sqrt(2 pi) Verified with Maxima using 80-digit precision. More... | |
#define | ROUND(X) (floor((X) + 0.5)) |
Round double X. More... | |
#define | ROUNDF(X) (floor((X) + 0.5f)) |
Round float X. More... | |
#define | ATTRIBUTE_UNUSED |
#define | ATTRIBUTE_ALWAYSINLINE |
Functions | |
void * | MallocWithErrorMessage (size_t Size) |
malloc with an error message on failure. More... | |
void * | ReallocWithErrorMessage (void *Ptr, size_t Size) |
realloc with an error message and free on failure. More... | |
void | ErrorMessage (const char *Format,...) |
Redefine this function to customize error messages. More... | |
unsigned long | Clock () |
Memory management, portable types, math constants, and timing.
This purpose of this file is to improve portability.
Types uint8_t
, uint16_t
, uint32_t
should be defined as unsigned integer types such that
uint8_t
is 8-bit, range 0 to 255 uint16_t
is 16-bit, range 0 to 65535 uint32_t
is 32-bit, range 0 to 4294967295Similarly, int8_t
, int16_t
, int32_t
should be defined as signed integer types such that
int8_t
is 8-bit, range -128 to +127 int16_t
is 16-bit, range -32768 to +32767 int32_t
is 32-bit, range -2147483648 to +2147483647These definitions are implemented with types __int8
, __int16
, and __int32
under Windows and by including stdint.h under UNIX.
To define the math constants, math.h is included, and any of the following that were not defined by math.h are defined here according to the values from Hart & Cheney.
Copyright (c) 2010-2011, Pascal Getreuer All rights reserved.
This program is free software: you can use, modify and/or redistribute it under the terms of the simplified BSD License. You should have received a copy of this license along this program. If not, see http://www.opensource.org/licenses/bsd-license.html.
Definition in file basic.h.
#define M_1_SQRT2 0.70710678118654752440084436210484904 |
#define M_2PI 6.28318530717958647692528676655900576 |
#define M_E 2.71828182845904523536028747135266250 |
#define M_EULER 0.57721566490153286060651209008240243 |
#define M_LN10 2.30258509299404568401799145468436421 |
#define M_LN2 0.69314718055994530941723212145817657 |
#define M_LOG10E 0.43429448190325182765112891891660508 |
#define M_LOG2E 1.44269504088896340735992468100189213 |
#define M_PI 3.14159265358979323846264338327950288 |
#define M_PI_2 1.57079632679489661923132169163975144 |
#define M_PI_4 0.78539816339744830961566084581987572 |
#define M_PI_8 0.39269908169872415480783042290993786 |
#define M_SQRT2 1.41421356237309504880168872420969808 |
#define M_SQRT2PI 2.50662827463100050241576528481104525 |
#define Malloc | ( | s | ) | MallocWithErrorMessage(s) |
#define Realloc | ( | p, | |
s | |||
) | ReallocWithErrorMessage(p, s) |
unsigned long Clock | ( | ) |
void ErrorMessage | ( | const char * | Format, |
... | |||
) |
void* MallocWithErrorMessage | ( | size_t | Size | ) |