| { | |
| "name": "loop_103", | |
| "op_type": "loop_103", | |
| "description": "Find all whitespace character positions in a byte string", | |
| "tags": [ | |
| "simd-loop" | |
| ], | |
| "axes": { | |
| "N": { | |
| "type": "var", | |
| "description": "Buffer length (bytes)" | |
| } | |
| }, | |
| "inputs": { | |
| "p": { | |
| "shape": [ | |
| "N" | |
| ], | |
| "dtype": "uint8" | |
| } | |
| }, | |
| "outputs": { | |
| "checksum": { | |
| "shape": null, | |
| "dtype": "int32", | |
| "description": "Scalar checksum" | |
| } | |
| }, | |
| "reference": "import numpy as np\n\n_WS = {32, 10, 13, 9}\n\ndef run(p):\n b = p; n = len(b); i = 0\n while i < n and int(b[i]) in _WS: i += 1\n count = 0\n while i < n:\n count += 1\n while i < n and int(b[i]) not in _WS: i += 1\n while i < n and int(b[i]) in _WS: i += 1\n return np.int32(count)\n", | |
| "simd_loop_meta": { | |
| "output_inplace": false, | |
| "array_pad": 0, | |
| "scratch": [], | |
| "axes_order": [] | |
| } | |
| } | |