// Copyright © 2017-2018 Mozilla Foundation
//
// This program is made available under an ISC-style license. See the
// accompanying file LICENSE for details.
use std::ops;
#[ repr(C)]
#[ derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct CorkState(u32);
const UNCORK: u32 = 0 b00;
const CORK: u32 = 0 b01;
const NOTIFY: u32 = 0 b10;
const ALL: u32 = 0 b11;
impl CorkState {
#[ inline]
pub fn uncork() -> Self {
CorkState(UNCORK)
}
#[ inline]
pub fn cork() -> Self {
CorkState(CORK)
}
#[ inline]
pub fn notify() -> Self {
CorkState(NOTIFY)
}
#[ inline]
pub fn is_cork(&self ) -> bool {
self .contains(CorkState::cork())
}
#[ inline]
pub fn is_notify(&self ) -> bool {
self .contains(CorkState::notify())
}
#[ inline]
pub fn contains(&self , other: Self ) -> bool {
(*self & other) == other
}
}
impl ops::BitOr for CorkState {
type Output = CorkState;
#[ inline]
fn bitor(self , other: Self ) -> Self {
CorkState(self .0 | other.0 )
}
}
impl ops::BitXor for CorkState {
type Output = CorkState;
#[ inline]
fn bitxor(self , other: Self ) -> Self {
CorkState(self .0 ^ other.0 )
}
}
impl ops::BitAnd for CorkState {
type Output = CorkState;
#[ inline]
fn bitand(self , other: Self ) -> Self {
CorkState(self .0 & other.0 )
}
}
impl ops::Sub for CorkState {
type Output = CorkState;
#[ inline]
fn sub(self , other: Self ) -> Self {
CorkState(self .0 & !other.0 )
}
}
impl ops::Not for CorkState {
type Output = CorkState;
#[ inline]
fn not(self ) -> Self {
CorkState(!self .0 & ALL)
}
}
Messung V0.5 in Prozent C=91 H=97 G=93
¤ Dauer der Verarbeitung: 0.8 Sekunden
(vorverarbeitet am 2026-06-22)
¤
*© Formatika GbR, Deutschland