-
Notifications
You must be signed in to change notification settings - Fork 360
Open
Labels
Description
bitflags! {
#[repr(transparent)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct MemoryProtection: u32 {
const NONE = 0;
/// Execute
const X = 1 << 0;
/// Read
const R = 1 << 1;
/// Write
const W = 1 << 2;
/// Copy
const C = 1 << 3;
/// Execute and Read
const XR = Self::X.bits() | Self::R.bits();
/// Execute, Read and Write
const XRW = Self::X.bits() | Self::R.bits() | Self::W.bits();
/// Execute, Write and Copy
const XWC = Self::X.bits() | Self::W.bits() | Self::C.bits();
/// Read and Write
const RW = Self::R.bits() | Self::W.bits();
/// Write and Copy
const WC = Self::W.bits() | Self::C.bits();
/// Read and Copy
const RC = Self::R.bits() | Self::C.bits();
/// Read, Write and Copy
const RWC = Self::R.bits() | Self::W.bits() | Self::C.bits();
}
}Generates:
using MemoryProtection = uint32_t;
constexpr static const MemoryProtection MemoryProtection_NONE = (uint32_t)0;
/// Execute
constexpr static const MemoryProtection MemoryProtection_X = (uint32_t)(1 << 0);
/// Read
constexpr static const MemoryProtection MemoryProtection_R = (uint32_t)(1 << 1);
/// Write
constexpr static const MemoryProtection MemoryProtection_W = (uint32_t)(1 << 2);
/// Copy
constexpr static const MemoryProtection MemoryProtection_C = (uint32_t)(1 << 3);
/// Execute and Read
constexpr static const MemoryProtection MemoryProtection_XR = (uint32_t)((MemoryProtection_X).bits | (MemoryProtection_R).bits);
/// Execute, Read and Write
constexpr static const MemoryProtection MemoryProtection_XRW = (uint32_t)(((MemoryProtection_X).bits | (MemoryProtection_R).bits) | (MemoryProtection_W).bits);
/// Execute, Write and Copy
constexpr static const MemoryProtection MemoryProtection_XWC = (uint32_t)(((MemoryProtection_X).bits | (MemoryProtection_W).bits) | (MemoryProtection_C).bits);
/// Read and Write
constexpr static const MemoryProtection MemoryProtection_RW = (uint32_t)((MemoryProtection_R).bits | (MemoryProtection_W).bits);
/// Write and Copy
constexpr static const MemoryProtection MemoryProtection_WC = (uint32_t)((MemoryProtection_W).bits | (MemoryProtection_C).bits);
/// Read and Copy
constexpr static const MemoryProtection MemoryProtection_RC = (uint32_t)((MemoryProtection_R).bits | (MemoryProtection_C).bits);
/// Read, Write and Copy
constexpr static const MemoryProtection MemoryProtection_RWC = (uint32_t)(((MemoryProtection_R).bits | (MemoryProtection_W).bits) | (MemoryProtection_C).bits);
The Problem:
Prints .bits
mostly related to #881