Skip to content

Commit c50cf65

Browse files
committed
arch/x86_64: Use size_of_val
Signed-off-by: Akira Moroo <[email protected]>
1 parent 6299a7e commit c50cf65

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/arch/x86_64/gdt.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// Copyright 2020 Google LLC
33

4-
use core::mem::size_of;
5-
64
bitflags::bitflags! {
75
// An extension of x86_64::structures::gdt::DescriptorFlags
86
struct Descriptor: u64 {
@@ -43,7 +41,7 @@ struct Pointer {
4341

4442
impl Pointer {
4543
const fn new(gdt: &'static [Descriptor]) -> Self {
46-
let size = gdt.len() * size_of::<Descriptor>();
44+
let size = core::mem::size_of_val(gdt);
4745
Self {
4846
limit: size as u16 - 1,
4947
base: &gdt[0],

0 commit comments

Comments
 (0)