| 333 | } |
| 334 | |
| 335 | WARN_UNUSED_RESULT bool amount_msat_scale(struct amount_msat *val, |
| 336 | struct amount_msat msat, |
| 337 | double scale) |
| 338 | { |
| 339 | double scaled = msat.millisatoshis * scale; |
| 340 | |
| 341 | /* If mantissa is < 64 bits, a naive "if (scaled > |
| 342 | * UINT64_MAX)" doesn't work. Stick to powers of 2. */ |
| 343 | if (scaled >= (double)((u64)1 << 63) * 2) |
| 344 | return false; |
| 345 | val->millisatoshis = scaled; |
| 346 | return true; |
| 347 | } |
| 348 | |
| 349 | WARN_UNUSED_RESULT bool amount_sat_scale(struct amount_sat *val, |
| 350 | struct amount_sat sat, |
no outgoing calls
no test coverage detected