gecko-dev/servo/src/components/script/macros.rs
Bruno de Oliveira Abinader e193dd8f9c servo: Merge #1427 - Make Node::is_in_doc O(1) (from brunoabinader:is-in-doc); r=jdm
Added a flags variable inside Node to represent boolean flags, with
is_in_doc being the first of them. It is updated whenever a node is
appended or removed from a parent.

This patch is for:
https://github.com/mozilla/servo/issues/1030

Source-Repo: https://github.com/servo/servo
Source-Revision: 44a8b0987c0bc0b136cfb4c75bc35a4a0de34465

--HG--
rename : servo/src/components/gfx/macros.rs => servo/src/components/script/macros.rs
2013-12-17 12:41:10 -08:00

22 lines
669 B
Rust

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#[macro_escape];
macro_rules! bitfield(
($bitfieldname:ident, $getter:ident, $setter:ident, $value:expr) => (
impl $bitfieldname {
#[inline]
pub fn $getter(self) -> bool {
(*self & $value) != 0
}
#[inline]
pub fn $setter(&mut self, value: bool) {
*self = $bitfieldname((**self & !$value) | (if value { $value } else { 0 }))
}
}
)
)