Checked addition of `ScalarValue` NB: operating on `ScalarValue` directly is not efficient, performance sensitive code should operate on Arrays directly, using vectorized array kernels
(&self, other: T)
| 2411 | /// NB: operating on `ScalarValue` directly is not efficient, performance sensitive code |
| 2412 | /// should operate on Arrays directly, using vectorized array kernels |
| 2413 | pub fn add_checked<T: Borrow<ScalarValue>>(&self, other: T) -> Result<ScalarValue> { |
| 2414 | let other = other.borrow(); |
| 2415 | if Self::can_use_direct_add(self, other) { |
| 2416 | let mut result = self.clone(); |
| 2417 | if result.try_add_checked_in_place(other)? { |
| 2418 | return Ok(result); |
| 2419 | } |
| 2420 | debug_assert!(false, "fast-path eligibility drifted from implementation"); |
| 2421 | } |
| 2422 | |
| 2423 | let r = add(&self.to_scalar()?, &other.to_scalar()?)?; |
| 2424 | Self::try_from_array(r.as_ref(), 0) |
| 2425 | } |
| 2426 | |
| 2427 | /// Wrapping subtraction of `ScalarValue` |
| 2428 | /// |
no test coverage detected