| 347 | } |
| 348 | |
| 349 | WARN_UNUSED_RESULT bool amount_sat_scale(struct amount_sat *val, |
| 350 | struct amount_sat sat, |
| 351 | double scale) |
| 352 | { |
| 353 | double scaled = sat.satoshis * scale; |
| 354 | |
| 355 | /* If mantissa is < 64 bits, a naive "if (scaled > |
| 356 | * UINT64_MAX)" doesn't work. Stick to powers of 2. */ |
| 357 | if (scaled >= (double)((u64)1 << 63) * 2) |
| 358 | return false; |
| 359 | val->satoshis = scaled; |
| 360 | return true; |
| 361 | } |
| 362 | |
| 363 | bool amount_sat_eq(struct amount_sat a, struct amount_sat b) |
| 364 | { |
no outgoing calls
no test coverage detected