File size: 941 Bytes
f25167e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | {
"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": []
}
}
|