| 21 | // Returns true if kind is numeric (kFloat32..kUint64), false for kBool/kString. |
| 22 | template <typename F> |
| 23 | bool dispatchNumericKind(StorageKind kind, F&& fn) { |
| 24 | switch (kind) { |
| 25 | case StorageKind::kFloat32: |
| 26 | fn(static_cast<const float*>(nullptr)); |
| 27 | return true; |
| 28 | case StorageKind::kFloat64: |
| 29 | fn(static_cast<const double*>(nullptr)); |
| 30 | return true; |
| 31 | case StorageKind::kInt32: |
| 32 | fn(static_cast<const int32_t*>(nullptr)); |
| 33 | return true; |
| 34 | case StorageKind::kInt64: |
| 35 | fn(static_cast<const int64_t*>(nullptr)); |
| 36 | return true; |
| 37 | case StorageKind::kUint64: |
| 38 | fn(static_cast<const uint64_t*>(nullptr)); |
| 39 | return true; |
| 40 | default: |
| 41 | return false; |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | // Read a raw numeric value from a buffer, dispatching on StorageKind. |
| 46 | template <typename R> |
no outgoing calls
no test coverage detected