1
0
Fork 0
forked from wry/wry

wayland: add u64 type macro

This commit is contained in:
Julian Orth 2025-06-04 13:24:28 +02:00
parent 7373509274
commit d6b3973979
30 changed files with 69 additions and 67 deletions

View file

@ -43,6 +43,16 @@ impl<'a> MsgFormatter<'a> {
self
}
pub fn u64(&mut self, int: u64) -> &mut Self {
self.uint((int >> 32) as u32);
self.uint(int as u32)
}
pub fn u64_rev(&mut self, int: u64) -> &mut Self {
self.uint(int as u32);
self.uint((int >> 32) as u32)
}
pub fn fixed(&mut self, fixed: Fixed) -> &mut Self {
self.write(uapi::as_bytes(&fixed.0));
self

View file

@ -52,6 +52,18 @@ impl<'a, 'b> MsgParser<'a, 'b> {
self.int().map(|i| i as u32)
}
pub fn u64(&mut self) -> Result<u64, MsgParserError> {
let hi = self.uint()?;
let lo = self.uint()?;
Ok(((hi as u64) << 32) | lo as u64)
}
pub fn u64_rev(&mut self) -> Result<u64, MsgParserError> {
let lo = self.uint()?;
let hi = self.uint()?;
Ok(((hi as u64) << 32) | lo as u64)
}
pub fn object<T>(&mut self) -> Result<T, MsgParserError>
where
ObjectId: Into<T>,