gitee.com/quant1x/gox@v1.7.6/num/asm/_cpp/comparison.cpp (about) 1 #include <cstddef> 2 3 template<typename T> 4 void Lt(bool* __restrict dst, T* x, T* y, size_t n) { 5 for (size_t i = 0; i < n; i++) { 6 if (x[i] < y[i]) { 7 dst[i] = true; 8 } else { 9 dst[i] = false; 10 } 11 } 12 } 13 14 template<typename T> 15 void LtNumber(bool* __restrict dst, T* x, T a, size_t n) { 16 for (size_t i = 0; i < n; i++) { 17 if (x[i] < a) { 18 dst[i] = true; 19 } else { 20 dst[i] = false; 21 } 22 } 23 } 24 25 template<typename T> 26 void Lte(bool* __restrict dst, T* x, T* y, size_t n) { 27 for (size_t i = 0; i < n; i++) { 28 if (x[i] <= y[i]) { 29 dst[i] = true; 30 } else { 31 dst[i] = false; 32 } 33 } 34 } 35 36 template<typename T> 37 void LteNumber(bool* __restrict dst, T* x, T a, size_t n) { 38 for (size_t i = 0; i < n; i++) { 39 if (x[i] <= a) { 40 dst[i] = true; 41 } else { 42 dst[i] = false; 43 } 44 } 45 } 46 47 template<typename T> 48 void Gt(bool* __restrict dst, T* x, T* y, size_t n) { 49 for (size_t i = 0; i < n; i++) { 50 if (x[i] > y[i]) { 51 dst[i] = true; 52 } else { 53 dst[i] = false; 54 } 55 } 56 } 57 58 template<typename T> 59 void GtNumber(bool* __restrict dst, T* x, T a, size_t n) { 60 for (size_t i = 0; i < n; i++) { 61 if (x[i] > a) { 62 dst[i] = true; 63 } else { 64 dst[i] = false; 65 } 66 } 67 } 68 69 template<typename T> 70 void Gte(bool* __restrict dst, T* x, T* y, size_t n) { 71 for (size_t i = 0; i < n; i++) { 72 if (x[i] >= y[i]) { 73 dst[i] = true; 74 } else { 75 dst[i] = false; 76 } 77 } 78 } 79 80 template<typename T> 81 void GteNumber(bool* __restrict dst, T* x, T a, size_t n) { 82 for (size_t i = 0; i < n; i++) { 83 if (x[i] >= a) { 84 dst[i] = true; 85 } else { 86 dst[i] = false; 87 } 88 } 89 } 90 91 template<typename T> 92 void Eq(bool* __restrict dst, T* x, T* y, size_t n) { 93 for (size_t i = 0; i < n; i++) { 94 if (x[i] == y[i]) { 95 dst[i] = true; 96 } else { 97 dst[i] = false; 98 } 99 } 100 } 101 102 template<typename T> 103 void EqNumber(bool* __restrict dst, T* x, T a, size_t n) { 104 for (size_t i = 0; i < n; i++) { 105 if (x[i] == a) { 106 dst[i] = true; 107 } else { 108 dst[i] = false; 109 } 110 } 111 } 112 113 template<typename T> 114 void Neq(bool* __restrict dst, T* x, T* y, size_t n) { 115 for (size_t i = 0; i < n; i++) { 116 if (x[i] != y[i]) { 117 dst[i] = true; 118 } else { 119 dst[i] = false; 120 } 121 } 122 } 123 124 template<typename T> 125 void NeqNumber(bool* __restrict dst, T* x, T a, size_t n) { 126 for (size_t i = 0; i < n; i++) { 127 if (x[i] != a) { 128 dst[i] = true; 129 } else { 130 dst[i] = false; 131 } 132 } 133 } 134 135 void Lt_F64_V(bool* __restrict dst, double* x, double* y, size_t n) { 136 Lt(dst, x, y, n); 137 } 138 139 void Lt_F32_V(bool* __restrict dst, float* x, float* y, size_t n) { 140 Lt(dst, x, y, n); 141 } 142 143 void Lte_F64_V(bool* __restrict dst, double* x, double* y, size_t n) { 144 Lte(dst, x, y, n); 145 } 146 147 void Lte_F32_V(bool* __restrict dst, float* x, float* y, size_t n) { 148 Lte(dst, x, y, n); 149 } 150 151 void Gt_F64_V(bool* __restrict dst, double* x, double* y, size_t n) { 152 Gt(dst, x, y, n); 153 } 154 155 void Gt_F32_V(bool* __restrict dst, float* x, float* y, size_t n) { 156 Gt(dst, x, y, n); 157 } 158 159 void Gte_F64_V(bool* __restrict dst, double* x, double* y, size_t n) { 160 Gte(dst, x, y, n); 161 } 162 163 void Gte_F32_V(bool* __restrict dst, float* x, float* y, size_t n) { 164 Gte(dst, x, y, n); 165 } 166 167 void Eq_F64_V(bool* __restrict dst, double* x, double* y, size_t n) { 168 Eq(dst, x, y, n); 169 } 170 171 void Eq_F32_V(bool* __restrict dst, float* x, float* y, size_t n) { 172 Eq(dst, x, y, n); 173 } 174 175 void Neq_F64_V(bool* __restrict dst, double* x, double* y, size_t n) { 176 Neq(dst, x, y, n); 177 } 178 179 void Neq_F32_V(bool* __restrict dst, float* x, float* y, size_t n) { 180 Neq(dst, x, y, n); 181 } 182 183 void LtNumber_F64_V(bool* __restrict dst, double* x, double a, size_t n) { 184 LtNumber(dst, x, a, n); 185 } 186 187 void LtNumber_F32_V(bool* __restrict dst, float* x, float a, size_t n) { 188 LtNumber(dst, x, a, n); 189 } 190 191 void LteNumber_F64_V(bool* __restrict dst, double* x, double a, size_t n) { 192 LteNumber(dst, x, a, n); 193 } 194 195 void LteNumber_F32_V(bool* __restrict dst, float* x, float a, size_t n) { 196 LteNumber(dst, x, a, n); 197 } 198 199 void GtNumber_F64_V(bool* __restrict dst, double* x, double a, size_t n) { 200 GtNumber(dst, x, a, n); 201 } 202 203 void GtNumber_F32_V(bool* __restrict dst, float* x, float a, size_t n) { 204 GtNumber(dst, x, a, n); 205 } 206 207 void GteNumber_F64_V(bool* __restrict dst, double* x, double a, size_t n) { 208 GteNumber(dst, x, a, n); 209 } 210 211 void GteNumber_F32_V(bool* __restrict dst, float* x, float a, size_t n) { 212 GteNumber(dst, x, a, n); 213 } 214 215 void EqNumber_F64_V(bool* __restrict dst, double* x, double a, size_t n) { 216 EqNumber(dst, x, a, n); 217 } 218 219 void EqNumber_F32_V(bool* __restrict dst, float* x, float a, size_t n) { 220 EqNumber(dst, x, a, n); 221 } 222 223 void NeqNumber_F64_V(bool* __restrict dst, double* x, double a, size_t n) { 224 NeqNumber(dst, x, a, n); 225 } 226 227 void NeqNumber_F32_V(bool* __restrict dst, float* x, float a, size_t n) { 228 NeqNumber(dst, x, a, n); 229 }