mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 20:48:55 +00:00
d6945a09b8
A few files were missing license blurbs at the top, so update them all to include them. BUG=none TEST=none Change-Id: Ida101be2e5c255b8cffeb15f5b93f63bfd1b130b Reviewed-on: https://chromium-review.googlesource.com/1577900 Commit-Ready: Stephen Barber <smbarber@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
27 lines
607 B
Rust
27 lines
607 B
Rust
// Copyright 2019 The Chromium OS Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
use bit_field::*;
|
|
|
|
#[bitfield]
|
|
#[bits = 5]
|
|
#[derive(Debug, PartialEq)]
|
|
pub struct FiveBits(u8);
|
|
|
|
#[bitfield]
|
|
struct Struct {
|
|
prefix: BitField1,
|
|
five_bits: FiveBits,
|
|
suffix: BitField2,
|
|
}
|
|
|
|
#[test]
|
|
fn test_enum() {
|
|
let mut s = Struct::new();
|
|
assert_eq!(s.get(0, 8), 0b_0000_0000);
|
|
|
|
s.set_five_bits(FiveBits(0b10101));
|
|
assert_eq!(s.get(0, 8), 0b_0010_1010);
|
|
assert_eq!(s.get_five_bits(), FiveBits(0b10101));
|
|
}
|