Returns false if the the floating point encoding requires a bit width different from the given width. Write the expected bit width via *expected.
| 156 | // Returns false if the the floating point encoding requires a bit width |
| 157 | // different from the given width. Write the expected bit width via *expected. |
| 158 | bool validBitWidthForFPEncoding(spv_fp_encoding_t enc, uint32_t width, |
| 159 | uint32_t* expected) { |
| 160 | switch (enc) { |
| 161 | case SPV_FP_ENCODING_IEEE754_BINARY16: |
| 162 | case SPV_FP_ENCODING_BFLOAT16: |
| 163 | *expected = 16; |
| 164 | break; |
| 165 | case SPV_FP_ENCODING_IEEE754_BINARY32: |
| 166 | *expected = 32; |
| 167 | break; |
| 168 | case SPV_FP_ENCODING_IEEE754_BINARY64: |
| 169 | *expected = 64; |
| 170 | break; |
| 171 | case SPV_FP_ENCODING_FLOAT8_E5M2: |
| 172 | case SPV_FP_ENCODING_FLOAT8_E4M3: |
| 173 | *expected = 8; |
| 174 | break; |
| 175 | default: |
| 176 | return true; |
| 177 | } |
| 178 | return width == *expected; |
| 179 | } |
| 180 | |
| 181 | } // namespace |
| 182 |
no outgoing calls
no test coverage detected