We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0626232 commit 6141a65Copy full SHA for 6141a65
src/write.rs
@@ -1904,6 +1904,19 @@ impl<N: Counter> BitWrite for BitCounter<N> {
1904
Ok(())
1905
}
1906
1907
+ #[inline]
1908
+ fn write_const<const BITS: u32, const VALUE: u32>(&mut self) -> io::Result<()> {
1909
+ const {
1910
+ assert!(
1911
+ BITS == 0 || VALUE <= (u32::ALL >> (u32::BITS_SIZE - BITS)),
1912
+ "excessive value for bits written"
1913
+ );
1914
+ }
1915
+
1916
+ self.bits.checked_add_assign(BITS.try_into().map_err(|_| Overflowed)?)?;
1917
+ Ok(())
1918
1919
1920
#[inline]
1921
fn write_unsigned<const BITS: u32, U>(&mut self, value: U) -> io::Result<()>
1922
where
0 commit comments