| 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> |
|---|
| 18 | #include <math.h> |
|---|
| 19 | #include <stdbool.h> |
|---|
| 20 | |
|---|
| 21 | #include "nrc_os_config.h" |
|---|
| 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 | |
|---|
| 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; \ |
|---|
| 44 | } |
|---|
| 45 | |
|---|
| 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 | |
|---|
| 57 | /* |
|---|
| 58 | * ----------- |
|---|
| 59 | * --- Not --- |
|---|
| 60 | * ----------- |
|---|
| 61 | */ |
|---|
| 62 | |
|---|
| 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 | } \ |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 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 | |
|---|
| 85 | /* |
|---|
| 86 | * ---------- |
|---|
| 87 | * --- Or --- |
|---|
| 88 | * ---------- |
|---|
| 89 | */ |
|---|
| 90 | |
|---|
| 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 | } \ |
|---|
| 104 | } |
|---|
| 105 | |
|---|
| 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); |
|---|
| 116 | |
|---|
| 117 | |
|---|
| 118 | /* |
|---|
| 119 | * ----------- |
|---|
| 120 | * --- Xor --- |
|---|
| 121 | * ----------- |
|---|
| 122 | */ |
|---|
| 123 | |
|---|
| 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 | } \ |
|---|
| 137 | } |
|---|
| 138 | |
|---|
| 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); |
|---|
| 149 | |
|---|
| 150 | |
|---|
| 151 | /* |
|---|
| 152 | * ---------- |
|---|
| 153 | * --- And --- |
|---|
| 154 | * ---------- |
|---|
| 155 | */ |
|---|
| 156 | |
|---|
| 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 | } \ |
|---|
| 170 | } |
|---|
| 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 | |
|---|