1 // Auto-generated file. Do not edit! 2 // Template: src/x8-lut/scalar.c.in 3 // Generator: tools/xngen 4 // 5 // Copyright 2021 Google LLC 6 // 7 // This source code is licensed under the BSD-style license found in the 8 // LICENSE file in the root directory of this source tree. 9 10 #include <assert.h> 11 12 #include <xnnpack/lut.h> 13 #include <xnnpack/common.h> 14 15 xnn_x8_lut_ukernel__scalar_x2(size_t n,const uint8_t * x,uint8_t * y,const uint8_t t[restrict XNN_MIN_ELEMENTS (256)])16void xnn_x8_lut_ukernel__scalar_x2( 17 size_t n, 18 const uint8_t* x, 19 uint8_t* y, 20 const uint8_t t[restrict XNN_MIN_ELEMENTS(256)]) 21 { 22 assert(n != 0); 23 assert(x != NULL); 24 assert(y != NULL); 25 26 for (; n >= 2 * sizeof(uint8_t); n -= 2 * sizeof(uint8_t)) { 27 const size_t vx0 = (size_t) x[0]; 28 const size_t vx1 = (size_t) x[1]; 29 x += 2; 30 31 const uint32_t vt0 = (uint32_t) t[vx0]; 32 const uint32_t vt1 = (uint32_t) t[vx1]; 33 34 y[0] = (uint8_t) vt0; 35 y[1] = (uint8_t) vt1; 36 y += 2; 37 } 38 if XNN_UNLIKELY(n != 0) { 39 const size_t vx = (size_t) *x; 40 const uint32_t vt = (uint32_t) t[vx]; 41 *y = (uint8_t) vt; 42 } 43 } 44