Skip to content

Commit

Permalink
style(kernel): remove use of trailing return types
Browse files Browse the repository at this point in the history
Although it looks nicer in my opinion, it appears that it is more
conventional to limit the use of `auto` to variable declarations and
other rare circumstances.
  • Loading branch information
ta5een committed Jun 20, 2024
1 parent ff6a0c8 commit f85d510
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/kernel/arch/i386/gdt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ GlobalDescriptorTable::GlobalDescriptorTable()
{
}

auto GlobalDescriptorTable::load() -> void
void GlobalDescriptorTable::load()
{
// Define the size (limit) and start (base) of the descriptor table
GlobalDescriptorTableRegister data = {
Expand Down Expand Up @@ -111,15 +111,15 @@ GlobalDescriptorTable::SegmentDescriptor::SegmentDescriptor(
m_access_byte = options.access_byte;
}

auto GlobalDescriptorTable::SegmentDescriptor::base() const -> u32
u32 GlobalDescriptorTable::SegmentDescriptor::base() const
{
u32 result = m_base_24_31;
result = (result << 8) + m_base_16_23;
result = (result << 16) + m_base_0_15;
return result;
}

auto GlobalDescriptorTable::SegmentDescriptor::limit() const -> u32
u32 GlobalDescriptorTable::SegmentDescriptor::limit() const
{
u32 result = m_flags_limit_16_19 & 0xF;
result = (result << 16) + m_limit_0_15;
Expand Down
10 changes: 5 additions & 5 deletions src/kernel/arch/i386/gdt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ class GlobalDescriptorTable
/**
* The decoded linear address where this segment begins.
*/
[[nodiscard]] auto base() const -> u32;
u32 base() const;

/**
* The decoded limit of this segment, respecting the page granularity
* such that it value ranges from 1 byte to 4 GiB.
*/
[[nodiscard]] auto limit() const -> u32;
u32 limit() const;

private:
SegmentDescriptor();
Expand All @@ -77,20 +77,20 @@ class GlobalDescriptorTable
/**
* Load the GlobalDescriptorTable by calling the LGDT instruction.
*/
auto load() -> void;
void load();

/**
* The raw value of the kernel code segment selector.
*/
auto code_segment_selector() const -> u16
u16 code_segment_selector() const
{
return (u8 *)&m_code_segment_selector - (u8 *)this;
}

/**
* The raw value of the kernel data segment selector.
*/
auto data_segment_selector() const -> u16
u16 data_segment_selector() const
{
return (u8 *)&m_data_segment_selector - (u8 *)this;
}
Expand Down

0 comments on commit f85d510

Please sign in to comment.