source: soft/giet_vm/applications/rosenfeld/nrc2/include/nrarith0.h

Last change on this file was 821, checked in by meunier, 8 years ago
  • Added several versions of rosenfeld: { SLOW, FAST } x { FEATURES, NO_FEATURES }
  • Added native linux compilation support
  • Added a script to check results natively
  • Started to refactor nrc code
File size: 2.0 KB
Line 
1/* ------------------ */
2/* --- nrarith0.h --- */
3/* ------------------ */
4
5/*
6 * Copyright (c) 2000-2014, Lionel Lacassagne, All rights reserved
7 * Univ Paris Sud XI, CNRS
8*/
9
10#ifndef __NRARITH0_H__
11#define __NRARITH0_H__
12
13/* ---------- */
14/* -- Swap -- */
15/* ---------- */
16
17#define type_swap(t)                   \
18void short_name(t,,swap)(t * a, t * b)
19
20type_swap(int8_t);
21type_swap(int16_t);
22type_swap(int32_t);
23type_swap(int64_t);
24type_swap(float);
25type_swap(double);
26type_swap(rgb8);
27type_swap(rgbx8);
28
29
30/* --------- */
31/* -- Min -- */
32/* --------- */
33
34#define type_min(t)                                 \
35t short_name(t,,min)(t x1, t x2);                   \
36t short_name(t,,min2)(t x1, t x2);                  \
37t short_name(t,,min3)(t x1, t x2, t x3);            \
38t short_name(t,,min4)(t x1, t x2, t x3, t x4);      \
39t short_name(t,,min5)(t x1, t x2, t x3, t x4, t x5) \
40
41type_min(float);
42type_min(double);
43type_min(int8_t);
44type_min(uint8_t);
45type_min(int16_t);
46type_min(uint16_t);
47type_min(int32_t);
48type_min(uint32_t);
49type_min(rgb8);
50
51
52/* --------- */
53/* -- Max -- */
54/* --------- */
55
56#define type_max(t)                                 \
57t short_name(t,,max)(t x1, t x2);                   \
58t short_name(t,,max2)(t x1, t x2);                  \
59t short_name(t,,max3)(t x1, t x2, t x3);            \
60t short_name(t,,max4)(t x1, t x2, t x3, t x4);      \
61t short_name(t,,max5)(t x1, t x2, t x3, t x4, t x5) \
62
63type_max(float);
64type_max(double);
65type_max(int8_t);
66type_max(uint8_t);
67type_max(int16_t);
68type_max(uint16_t);
69type_max(int32_t);
70type_max(uint32_t);
71type_max(rgb8);
72
73
74/* ----------- */
75/* -- Other -- */
76/* ----------- */
77
78int32_t i32bit(int32_t x, int32_t n);
79int32_t sym_int32(int32_t x);
80int32_t myLog2(int32_t x);
81int32_t next_power2(int32_t x);
82int32_t myGCD(int32_t u, int32_t v);
83int32_t myLCM(int32_t u, int32_t v);
84
85#endif
86
87// Local Variables:
88// tab-width: 4
89// c-basic-offset: 4
90// c-file-offsets:((innamespace . 0)(inline-open . 0))
91// indent-tabs-mode: nil
92// End:
93
94// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
95
Note: See TracBrowser for help on using the repository browser.