[772] | 1 | /* ----------------- */ |
---|
| 2 | /* --- nrbool2.c --- */ |
---|
| 3 | /* ----------------- */ |
---|
| 4 | |
---|
| 5 | /* |
---|
| 6 | * Copyright (c) 2000-2014, Lionel Lacassagne, All rights reserved |
---|
| 7 | * Univ Paris Sud XI, CNRS |
---|
| 8 | * |
---|
| 9 | * Distributed under the Boost Software License, Version 1.0 |
---|
| 10 | * see accompanying file LICENSE.txt or copy it at |
---|
| 11 | * http://www.boost.org/LICENSE_1_0.txt |
---|
| 12 | */ |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | #include <stdio.h> |
---|
| 16 | #include <stddef.h> |
---|
| 17 | #include <stdlib.h> |
---|
[822] | 18 | #include <math.h> |
---|
| 19 | #include <stdbool.h> |
---|
[772] | 20 | |
---|
[822] | 21 | #include "nrc_os_config.h" |
---|
[772] | 22 | #include "mypredef.h" |
---|
| 23 | #include "nrtype.h" |
---|
| 24 | #include "nrdef.h" |
---|
| 25 | #include "nrmacro.h" |
---|
| 26 | #include "nrkernel.h" |
---|
| 27 | |
---|
| 28 | #include "nrbool1.h" |
---|
| 29 | #include "nrbool2.h" |
---|
| 30 | |
---|
[822] | 31 | |
---|
| 32 | #undef cmpeq_type_matrix |
---|
| 33 | #define cmpeq_type_matrix(t) \ |
---|
| 34 | int32_t short_name(t,cmpeq_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y) \ |
---|
| 35 | { \ |
---|
| 36 | for (int32_t i = nrl; i <= nrh; i++) { \ |
---|
| 37 | for (int32_t j = ncl; j <= nch; j++) { \ |
---|
| 38 | if (X[i][j] != Y[i][j]) { \ |
---|
| 39 | return 1; \ |
---|
| 40 | } \ |
---|
| 41 | } \ |
---|
| 42 | } \ |
---|
| 43 | return 0; \ |
---|
[772] | 44 | } |
---|
| 45 | |
---|
[822] | 46 | cmpeq_type_matrix(int8_t); |
---|
| 47 | cmpeq_type_matrix(uint8_t); |
---|
| 48 | cmpeq_type_matrix(int16_t); |
---|
| 49 | cmpeq_type_matrix(uint16_t); |
---|
| 50 | cmpeq_type_matrix(int32_t); |
---|
| 51 | cmpeq_type_matrix(uint32_t); |
---|
| 52 | cmpeq_type_matrix(int64_t); |
---|
| 53 | cmpeq_type_matrix(uint64_t); |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | |
---|
[772] | 57 | /* |
---|
| 58 | * ----------- |
---|
| 59 | * --- Not --- |
---|
| 60 | * ----------- |
---|
| 61 | */ |
---|
| 62 | |
---|
[822] | 63 | #undef not_type_matrix |
---|
| 64 | #define not_type_matrix(t) \ |
---|
| 65 | void short_name(t,not_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y) \ |
---|
| 66 | { \ |
---|
| 67 | for (int32_t i = nrl; i <= nrh; i++) { \ |
---|
| 68 | short_name(t,not_,vector)(X[i], ncl, nch, Y[i]); \ |
---|
| 69 | } \ |
---|
[772] | 70 | } |
---|
| 71 | |
---|
[822] | 72 | not_type_matrix(int8_t); |
---|
| 73 | not_type_matrix(uint8_t); |
---|
| 74 | not_type_matrix(int16_t); |
---|
| 75 | not_type_matrix(uint16_t); |
---|
| 76 | not_type_matrix(int32_t); |
---|
| 77 | not_type_matrix(uint32_t); |
---|
| 78 | not_type_matrix(int64_t); |
---|
| 79 | not_type_matrix(uint64_t); |
---|
| 80 | not_type_matrix(rgb8); |
---|
| 81 | not_type_matrix(rgbx8); |
---|
| 82 | |
---|
| 83 | |
---|
| 84 | |
---|
[772] | 85 | /* |
---|
| 86 | * ---------- |
---|
| 87 | * --- Or --- |
---|
| 88 | * ---------- |
---|
| 89 | */ |
---|
| 90 | |
---|
[822] | 91 | #undef or_type_matrix |
---|
| 92 | #define or_type_matrix(t) \ |
---|
| 93 | void short_name(t,or_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y, t ** Z) \ |
---|
| 94 | { \ |
---|
| 95 | for (int32_t i = nrl; i <= nrh; i++) { \ |
---|
| 96 | short_name(t,or_,vector)(X[i], ncl, nch, Y[i], Z[i]); \ |
---|
| 97 | } \ |
---|
| 98 | } \ |
---|
| 99 | void short_name(t,orc_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t y, t ** Z) \ |
---|
| 100 | { \ |
---|
| 101 | for (int32_t i = nrl; i <= nrh; i++) { \ |
---|
| 102 | short_name(t,orc_,vector)(X[i], ncl, nch, y, Z[i]); \ |
---|
| 103 | } \ |
---|
[772] | 104 | } |
---|
| 105 | |
---|
[822] | 106 | or_type_matrix(int8_t); |
---|
| 107 | or_type_matrix(uint8_t); |
---|
| 108 | or_type_matrix(int16_t); |
---|
| 109 | or_type_matrix(uint16_t); |
---|
| 110 | or_type_matrix(int32_t); |
---|
| 111 | or_type_matrix(uint32_t); |
---|
| 112 | or_type_matrix(int64_t); |
---|
| 113 | or_type_matrix(uint64_t); |
---|
| 114 | or_type_matrix(rgb8); |
---|
| 115 | or_type_matrix(rgbx8); |
---|
[772] | 116 | |
---|
[822] | 117 | |
---|
[772] | 118 | /* |
---|
| 119 | * ----------- |
---|
| 120 | * --- Xor --- |
---|
| 121 | * ----------- |
---|
| 122 | */ |
---|
| 123 | |
---|
[822] | 124 | #undef xor_type_matrix |
---|
| 125 | #define xor_type_matrix(t) \ |
---|
| 126 | void short_name(t,xor_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y, t ** Z) \ |
---|
| 127 | { \ |
---|
| 128 | for (int32_t i = nrl; i <= nrh; i++) { \ |
---|
| 129 | short_name(t,xor_,vector)(X[i], ncl, nch, Y[i], Z[i]); \ |
---|
| 130 | } \ |
---|
| 131 | } \ |
---|
| 132 | void short_name(t,xorc_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t y, t ** Z) \ |
---|
| 133 | { \ |
---|
| 134 | for (int32_t i = nrl; i <= nrh; i++) { \ |
---|
| 135 | short_name(t,xorc_,vector)(X[i], ncl, nch, y, Z[i]); \ |
---|
| 136 | } \ |
---|
[772] | 137 | } |
---|
| 138 | |
---|
[822] | 139 | xor_type_matrix(int8_t); |
---|
| 140 | xor_type_matrix(uint8_t); |
---|
| 141 | xor_type_matrix(int16_t); |
---|
| 142 | xor_type_matrix(uint16_t); |
---|
| 143 | xor_type_matrix(int32_t); |
---|
| 144 | xor_type_matrix(uint32_t); |
---|
| 145 | xor_type_matrix(int64_t); |
---|
| 146 | xor_type_matrix(uint64_t); |
---|
| 147 | xor_type_matrix(rgb8); |
---|
| 148 | xor_type_matrix(rgbx8); |
---|
[772] | 149 | |
---|
[822] | 150 | |
---|
[772] | 151 | /* |
---|
| 152 | * ---------- |
---|
| 153 | * --- And --- |
---|
| 154 | * ---------- |
---|
| 155 | */ |
---|
| 156 | |
---|
[822] | 157 | #undef and_type_matrix |
---|
| 158 | #define and_type_matrix(t) \ |
---|
| 159 | void short_name(t,and_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y, t ** Z) \ |
---|
| 160 | { \ |
---|
| 161 | for (int32_t i = nrl; i <= nrh; i++) { \ |
---|
| 162 | short_name(t,and_,vector)(X[i], ncl, nch, Y[i], Z[i]); \ |
---|
| 163 | } \ |
---|
| 164 | } \ |
---|
| 165 | void short_name(t,andc_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t y, t ** Z) \ |
---|
| 166 | { \ |
---|
| 167 | for (int32_t i = nrl; i <= nrh; i++) { \ |
---|
| 168 | short_name(t,andc_,vector)(X[i], ncl, nch, y, Z[i]); \ |
---|
| 169 | } \ |
---|
[772] | 170 | } |
---|
[822] | 171 | |
---|
| 172 | and_type_matrix(int8_t); |
---|
| 173 | and_type_matrix(uint8_t); |
---|
| 174 | and_type_matrix(int16_t); |
---|
| 175 | and_type_matrix(uint16_t); |
---|
| 176 | and_type_matrix(int32_t); |
---|
| 177 | and_type_matrix(uint32_t); |
---|
| 178 | and_type_matrix(int64_t); |
---|
| 179 | and_type_matrix(uint64_t); |
---|
| 180 | and_type_matrix(rgb8); |
---|
| 181 | and_type_matrix(rgbx8); |
---|
| 182 | |
---|
| 183 | |
---|
| 184 | // Local Variables: |
---|
| 185 | // tab-width: 4 |
---|
| 186 | // c-basic-offset: 4 |
---|
| 187 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
| 188 | // indent-tabs-mode: nil |
---|
| 189 | // End: |
---|
| 190 | |
---|
| 191 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
| 192 | |
---|