|
| 1 | +/** |
| 2 | +* @license Apache-2.0 |
| 3 | +* |
| 4 | +* Copyright (c) 2018 The Stdlib Authors. |
| 5 | +* |
| 6 | +* Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +* you may not use this file except in compliance with the License. |
| 8 | +* You may obtain a copy of the License at |
| 9 | +* |
| 10 | +* http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +* |
| 12 | +* Unless required by applicable law or agreed to in writing, software |
| 13 | +* distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +* See the License for the specific language governing permissions and |
| 16 | +* limitations under the License. |
| 17 | +*/ |
| 18 | + |
| 19 | +#ifndef STDLIB_NDARRAY_CTOR_GET_PTR_H |
| 20 | +#define STDLIB_NDARRAY_CTOR_GET_PTR_H |
| 21 | + |
| 22 | +#include <stdint.h> |
| 23 | +#include "ndarray.h" |
| 24 | + |
| 25 | +/** |
| 26 | +* Returns a byte array pointer to an ndarray data element. |
| 27 | +*/ |
| 28 | +uint8_t * stdlib_ndarray_get_ptr( const struct ndarray *arr, const int64_t *sub ); |
| 29 | + |
| 30 | +/** |
| 31 | +* Returns an ndarray data element specified by a byte array pointer. |
| 32 | +*/ |
| 33 | +int8_t stdlib_ndarray_get_ptr_value( const struct ndarray *arr, const uint8_t *idx, void *out ); |
| 34 | + |
| 35 | +/** |
| 36 | +* Returns a double-precision floating-point ndarray data element specified by a byte array pointer. |
| 37 | +*/ |
| 38 | +int8_t stdlib_ndarray_get_ptr_float64( const uint8_t *idx, double *out ); |
| 39 | + |
| 40 | +/** |
| 41 | +* Returns a single-precision floating-point ndarray data element specified by a byte array pointer. |
| 42 | +*/ |
| 43 | +int8_t stdlib_ndarray_get_ptr_float32( const uint8_t *idx, float *out ); |
| 44 | + |
| 45 | +/** |
| 46 | +* Returns an unsigned 64-bit integer ndarray data element specified by a byte array pointer. |
| 47 | +*/ |
| 48 | +int8_t stdlib_ndarray_get_ptr_uint64( const uint8_t *idx, uint64_t *out ); |
| 49 | + |
| 50 | +/** |
| 51 | +* Returns a signed 64-bit integer ndarray data element specified by a byte array pointer. |
| 52 | +*/ |
| 53 | +int8_t stdlib_ndarray_get_ptr_int64( const uint8_t *idx, int64_t *out ); |
| 54 | + |
| 55 | +/** |
| 56 | +* Returns an unsigned 32-bit integer ndarray data element specified by a byte array pointer. |
| 57 | +*/ |
| 58 | +int8_t stdlib_ndarray_get_ptr_uint32( const uint8_t *idx, uint32_t *out ); |
| 59 | + |
| 60 | +/** |
| 61 | +* Returns a signed 32-bit integer ndarray data element specified by a byte array pointer. |
| 62 | +*/ |
| 63 | +int8_t stdlib_ndarray_get_ptr_int32( const uint8_t *idx, int32_t *out ); |
| 64 | + |
| 65 | +/** |
| 66 | +* Returns an unsigned 16-bit integer ndarray data element specified by a byte array pointer. |
| 67 | +*/ |
| 68 | +int8_t stdlib_ndarray_get_ptr_uint16( const uint8_t *idx, uint16_t *out ); |
| 69 | + |
| 70 | +/** |
| 71 | +* Returns a signed 16-bit integer ndarray data element specified by a byte array pointer. |
| 72 | +*/ |
| 73 | +int8_t stdlib_ndarray_get_ptr_int16( const uint8_t *idx, int16_t *out ); |
| 74 | + |
| 75 | +/** |
| 76 | +* Returns an unsigned 8-bit integer ndarray data element specified by a byte array pointer. |
| 77 | +*/ |
| 78 | +int8_t stdlib_ndarray_get_ptr_uint8( const uint8_t *idx, uint8_t *out ); |
| 79 | + |
| 80 | +/** |
| 81 | +* Returns a signed 8-bit integer ndarray data element specified by a byte array pointer. |
| 82 | +*/ |
| 83 | +int8_t stdlib_ndarray_get_ptr_int8( const uint8_t *idx, int8_t *out ); |
| 84 | + |
| 85 | +#endif // !STDLIB_NDARRAY_CTOR_GET_PTR_H |
0 commit comments