- Timestamp:
- May 6, 2016, 3:06:29 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/rosenfeld/nrc2/include/nrarith0.h
r772 r821 11 11 #define __NRARITH0_H__ 12 12 13 #ifdef __cplusplus14 #pragma message ("C++")15 extern "C" {16 #endif17 18 #ifdef VERBOSE_PRAGMA19 //#pragma message(" -include nrarith0.h")20 #endif21 22 13 /* ---------- */ 23 14 /* -- Swap -- */ 24 15 /* ---------- */ 25 16 26 ROUTINE(void) i8swap(int8 *a, int8 *b); 27 ROUTINE(void) i16swap(int16 *a, int16 *b); 28 ROUTINE(void) i32swap(int32 *a, int32 *b); 29 ROUTINE(void) i64swap(int64 *a, int64 *b); 30 ROUTINE(void) f32swap(float32 *a, float32 *b); 31 ROUTINE(void) f64swap(float64 *a, float64 *b); 32 ROUTINE(void) rgb8swap(rgb8 *a, rgb8 *b); 33 ROUTINE(void) rgbx8swap(rgbx8 *a, rgbx8 *b); 17 #define type_swap(t) \ 18 void short_name(t,,swap)(t * a, t * b) 19 20 type_swap(int8_t); 21 type_swap(int16_t); 22 type_swap(int32_t); 23 type_swap(int64_t); 24 type_swap(float); 25 type_swap(double); 26 type_swap(rgb8); 27 type_swap(rgbx8); 28 34 29 35 30 /* --------- */ … … 37 32 /* --------- */ 38 33 39 ROUTINE(float32) f32min (float32 x1, float32 x2); 40 ROUTINE(float32) f32min2(float32 x1, float32 x2); 41 ROUTINE(float32) f32min3(float32 x1, float32 x2, float32 x3); 42 ROUTINE(float32) f32min4(float32 x1, float32 x2, float32 x3, float32 x4); 43 ROUTINE(float32) f32min5(float32 x1, float32 x2, float32 x3, float32 x4, float32 x5); 34 #define type_min(t) \ 35 t short_name(t,,min)(t x1, t x2); \ 36 t short_name(t,,min2)(t x1, t x2); \ 37 t short_name(t,,min3)(t x1, t x2, t x3); \ 38 t short_name(t,,min4)(t x1, t x2, t x3, t x4); \ 39 t short_name(t,,min5)(t x1, t x2, t x3, t x4, t x5) \ 44 40 45 ROUTINE(float64) f64min (float64 x1, float64 x2); 46 ROUTINE(float64) f64min2(float64 x1, float64 x2); 47 ROUTINE(float64) f64min3(float64 x1, float64 x2, float64 x3); 48 ROUTINE(float64) f64min4(float64 x1, float64 x2, float64 x3, float64 x4); 49 ROUTINE(float64) f64min5(float64 x1, float64 x2, float64 x3, float64 x4, float64 x5); 41 type_min(float); 42 type_min(double); 43 type_min(int8_t); 44 type_min(uint8_t); 45 type_min(int16_t); 46 type_min(uint16_t); 47 type_min(int32_t); 48 type_min(uint32_t); 49 type_min(rgb8); 50 50 51 ROUTINE(byte) bmin (byte x1, byte x2);52 ROUTINE(byte) bmin2(byte x1, byte x2);53 ROUTINE(byte) bmin3(byte x1, byte x2, byte x3);54 ROUTINE(byte) bmin4(byte x1, byte x2, byte x3, byte x4);55 ROUTINE(byte) bmin5(byte x1, byte x2, byte x3, byte x4, byte x5);56 57 ROUTINE(uint16) ui16min (uint16 x1, uint16 x2);58 ROUTINE(uint16) ui16min2(uint16 x1, uint16 x2);59 ROUTINE(uint16) ui16min3(uint16 x1, uint16 x2, uint16 x3);60 ROUTINE(uint16) ui16min4(uint16 x1, uint16 x2, uint16 x3, uint16 x4);61 ROUTINE(uint16) ui16min5(uint16 x1, uint16 x2, uint16 x3, uint16 x4, uint16 x5);62 63 ROUTINE(int32) i32min (int32 x1, int32 x2);64 ROUTINE(int32) i32min2(int32 x1, int32 x2);65 ROUTINE(int32) i32min3(int32 x1, int32 x2, int32 x3);66 ROUTINE(int32) i32min4(int32 x1, int32 x2, int32 x3, int32 x4);67 ROUTINE(int32) i32min5(int32 x1, int32 x2, int32 x3, int32 x4, int32 x5);68 69 ROUTINE(rgb8) rgb8min (rgb8 x1, rgb8 x2);70 ROUTINE(rgb8) rgb8min2(rgb8 x1, rgb8 x2);71 ROUTINE(rgb8) rgb8min3(rgb8 x1, rgb8 x2, rgb8 x3);72 ROUTINE(rgb8) rgb8min4(rgb8 x1, rgb8 x2, rgb8 x3, rgb8 x4);73 ROUTINE(rgb8) rgb8min5(rgb8 x1, rgb8 x2, rgb8 x3, rgb8 x4, rgb8 x5);74 51 75 52 /* --------- */ 76 53 /* -- Max -- */ 77 54 /* --------- */ 78 ROUTINE(float32) f32max (float32 x1, float32 x2);79 ROUTINE(float32) f32max2(float32 x1, float32 x2);80 ROUTINE(float32) f32max3(float32 x1, float32 x2, float32 x3);81 ROUTINE(float32) f32max4(float32 x1, float32 x2, float32 x3, float32 x4);82 ROUTINE(float32) f32max5(float32 x1, float32 x2, float32 x3, float32 x4, float32 x5);83 55 84 ROUTINE(float64) f64max (float64 x1, float64 x2); 85 ROUTINE(float64) f64max2(float64 x1, float64 x2); 86 ROUTINE(float64) f64max3(float64 x1, float64 x2, float64 x3); 87 ROUTINE(float64) f64max4(float64 x1, float64 x2, float64 x3, float64 x4); 88 ROUTINE(float64) f64max5(float64 x1, float64 x2, float64 x3, float64 x4, float64 x5); 56 #define type_max(t) \ 57 t short_name(t,,max)(t x1, t x2); \ 58 t short_name(t,,max2)(t x1, t x2); \ 59 t short_name(t,,max3)(t x1, t x2, t x3); \ 60 t short_name(t,,max4)(t x1, t x2, t x3, t x4); \ 61 t short_name(t,,max5)(t x1, t x2, t x3, t x4, t x5) \ 89 62 90 ROUTINE(byte) bmax (byte x1, byte x2); 91 ROUTINE(byte) bmax2(byte x1, byte x2); 92 ROUTINE(byte) bmax3(byte x1, byte x2, byte x3); 93 ROUTINE(byte) bmax4(byte x1, byte x2, byte x3, byte x4); 94 ROUTINE(byte) bmax5(byte x1, byte x2, byte x3, byte x4, byte x5); 63 type_max(float); 64 type_max(double); 65 type_max(int8_t); 66 type_max(uint8_t); 67 type_max(int16_t); 68 type_max(uint16_t); 69 type_max(int32_t); 70 type_max(uint32_t); 71 type_max(rgb8); 95 72 96 ROUTINE(uint16) ui16max (uint16 x1, uint16 x2);97 ROUTINE(uint16) ui16max2(uint16 x1, uint16 x2);98 ROUTINE(uint16) ui16max3(uint16 x1, uint16 x2, uint16 x3);99 ROUTINE(uint16) ui16max4(uint16 x1, uint16 x2, uint16 x3, uint16 x4);100 ROUTINE(uint16) ui16max5(uint16 x1, uint16 x2, uint16 x3, uint16 x4, uint16 x5);101 102 ROUTINE(int32) i32max (int32 x1, int32 x2);103 ROUTINE(int32) i32max2(int32 x1, int32 x2);104 ROUTINE(int32) i32max3(int32 x1, int32 x2, int32 x3);105 ROUTINE(int32) i32max4(int32 x1, int32 x2, int32 x3, int32 x4);106 ROUTINE(int32) i32max5(int32 x1, int32 x2, int32 x3, int32 x4, int32 x5);107 108 ROUTINE(rgb8) rgb8max (rgb8 x1, rgb8 x2);109 ROUTINE(rgb8) rgb8max2(rgb8 x1, rgb8 x2);110 ROUTINE(rgb8) rgb8max3(rgb8 x1, rgb8 x2, rgb8 x3);111 ROUTINE(rgb8) rgb8max4(rgb8 x1, rgb8 x2, rgb8 x3, rgb8 x4);112 ROUTINE(rgb8) rgb8max5(rgb8 x1, rgb8 x2, rgb8 x3, rgb8 x4, rgb8 x5);113 73 114 74 /* ----------- */ … … 116 76 /* ----------- */ 117 77 118 ROUTINE(byte) ibit(int32 x, int n);119 ROUTINE(int32) sym_int32(int32x);120 ROUTINE(int) myLog2(int x);121 ROUTINE(int) next_power2(int x);122 ROUTINE(int) myGCD(int u, int v);123 ROUTINE(int) myLCM(int u, int v);78 int32_t i32bit(int32_t x, int32_t n); 79 int32_t sym_int32(int32_t x); 80 int32_t myLog2(int32_t x); 81 int32_t next_power2(int32_t x); 82 int32_t myGCD(int32_t u, int32_t v); 83 int32_t myLCM(int32_t u, int32_t v); 124 84 125 #ifdef __cplusplus126 }127 85 #endif 128 86 129 #else 130 //#pragma message(" Warning : attempt to re-include nrarith0.h") 131 #endif 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: 132 93 94 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 95
Note: See TracChangeset
for help on using the changeset viewer.