Skip to content

Instantly share code, notes, and snippets.

@DanShaders
Created April 18, 2024 19:51
Show Gist options
  • Save DanShaders/a0e54da43e77e26fa32b100838fc5e3a to your computer and use it in GitHub Desktop.
Save DanShaders/a0e54da43e77e26fa32b100838fc5e3a to your computer and use it in GitHub Desktop.
diff --git a/AK/StdLibExtraDetails.h b/AK/StdLibExtraDetails.h
index 47680425be..922ba80730 100644
--- a/AK/StdLibExtraDetails.h
+++ b/AK/StdLibExtraDetails.h
@@ -126,9 +126,9 @@ inline constexpr bool IsFunction<Ret(Args...) const volatile&> = true;
template<class Ret, class... Args>
inline constexpr bool IsFunction<Ret(Args..., ...) const volatile&> = true;
template<class Ret, class... Args>
-inline constexpr bool IsFunction<Ret(Args...)&&> = true;
+inline constexpr bool IsFunction<Ret(Args...) &&> = true;
template<class Ret, class... Args>
-inline constexpr bool IsFunction<Ret(Args..., ...)&&> = true;
+inline constexpr bool IsFunction<Ret(Args..., ...) &&> = true;
template<class Ret, class... Args>
inline constexpr bool IsFunction<Ret(Args...) const&&> = true;
template<class Ret, class... Args>
diff --git a/AK/Utf16View.h b/AK/Utf16View.h
index 5d10b9a7b8..678d55e5d9 100644
--- a/AK/Utf16View.h
+++ b/AK/Utf16View.h
@@ -74,8 +74,8 @@ public:
template<size_t Size>
Utf16View(char16_t const (&code_units)[Size])
: m_code_units(
- reinterpret_cast<u16 const*>(&code_units[0]),
- code_units[Size - 1] == u'\0' ? Size - 1 : Size)
+ reinterpret_cast<u16 const*>(&code_units[0]),
+ code_units[Size - 1] == u'\0' ? Size - 1 : Size)
{
}
diff --git a/Kernel/API/POSIX/futex.h b/Kernel/API/POSIX/futex.h
index fd90aafee9..0b42e4584c 100644
--- a/Kernel/API/POSIX/futex.h
+++ b/Kernel/API/POSIX/futex.h
@@ -22,7 +22,7 @@ extern "C" {
#define _FUTEX_OP_MASK_CMP_ARG 0xfff
#define FUTEX_OP(op, op_arg, cmp, cmp_arg) \
- ((((op)&_FUTEX_OP_MASK_OP) << _FUTEX_OP_SHIFT_OP) | (((cmp)&_FUTEX_OP_MASK_CMP) << _FUTEX_OP_SHIFT_CMP) | (((op_arg)&_FUTEX_OP_MASK_OP_ARG) << _FUTEX_OP_SHIFT_OP_ARG) | (((cmp_arg)&_FUTEX_OP_MASK_CMP_ARG) << _FUTEX_OP_SHIFT_CMP_ARG))
+ ((((op) & _FUTEX_OP_MASK_OP) << _FUTEX_OP_SHIFT_OP) | (((cmp) & _FUTEX_OP_MASK_CMP) << _FUTEX_OP_SHIFT_CMP) | (((op_arg) & _FUTEX_OP_MASK_OP_ARG) << _FUTEX_OP_SHIFT_OP_ARG) | (((cmp_arg) & _FUTEX_OP_MASK_CMP_ARG) << _FUTEX_OP_SHIFT_CMP_ARG))
#define _FUTEX_OP(val3) (((val3) >> _FUTEX_OP_SHIFT_OP) & _FUTEX_OP_MASK_OP)
#define _FUTEX_CMP(val3) (((val3) >> _FUTEX_OP_SHIFT_CMP) & _FUTEX_OP_MASK_CMP)
diff --git a/Kernel/API/POSIX/sys/stat.h b/Kernel/API/POSIX/sys/stat.h
index 5c3a0b52f4..9391999165 100644
--- a/Kernel/API/POSIX/sys/stat.h
+++ b/Kernel/API/POSIX/sys/stat.h
@@ -42,13 +42,13 @@ extern "C" {
#define S_IRWXG (S_IRWXU >> 3)
#define S_IRWXO (S_IRWXG >> 3)
-#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
-#define S_ISCHR(m) (((m)&S_IFMT) == S_IFCHR)
-#define S_ISBLK(m) (((m)&S_IFMT) == S_IFBLK)
-#define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
-#define S_ISFIFO(m) (((m)&S_IFMT) == S_IFIFO)
-#define S_ISLNK(m) (((m)&S_IFMT) == S_IFLNK)
-#define S_ISSOCK(m) (((m)&S_IFMT) == S_IFSOCK)
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
struct stat {
dev_t st_dev; /* ID of device containing file */
diff --git a/Kernel/API/POSIX/sys/wait.h b/Kernel/API/POSIX/sys/wait.h
index 74d3ec0c07..f6b3eb2f7e 100644
--- a/Kernel/API/POSIX/sys/wait.h
+++ b/Kernel/API/POSIX/sys/wait.h
@@ -12,12 +12,12 @@
extern "C" {
#endif
-#define WEXITSTATUS(status) (((status)&0xff00) >> 8)
+#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
#define WSTOPSIG(status) WEXITSTATUS(status)
-#define WTERMSIG(status) ((status)&0x7f)
+#define WTERMSIG(status) ((status) & 0x7f)
#define WIFEXITED(status) (WTERMSIG(status) == 0)
-#define WIFSTOPPED(status) (((status)&0xff) == 0x7f)
-#define WIFSIGNALED(status) (((char)(((status)&0x7f) + 1) >> 1) > 0)
+#define WIFSTOPPED(status) (((status) & 0xff) == 0x7f)
+#define WIFSIGNALED(status) (((char)(((status) & 0x7f) + 1) >> 1) > 0)
#define WIFCONTINUED(status) ((status) == 0xffff)
#define WNOHANG 1
diff --git a/Kernel/Arch/CPU.h b/Kernel/Arch/CPU.h
index efe6c5925b..f8fce98148 100644
--- a/Kernel/Arch/CPU.h
+++ b/Kernel/Arch/CPU.h
@@ -11,9 +11,9 @@
#define PAGE_MASK (~(FlatPtr)0xfffu)
-#define LSW(x) ((u32)(x)&0xFFFF)
+#define LSW(x) ((u32)(x) & 0xFFFF)
#define MSW(x) (((u32)(x) >> 16) & 0xFFFF)
-#define LSB(x) ((x)&0xFF)
+#define LSB(x) ((x) & 0xFF)
#define MSB(x) (((x) >> 8) & 0xFF)
#if ARCH(X86_64)
diff --git a/Kernel/Arch/x86_64/Interrupts/APIC.cpp b/Kernel/Arch/x86_64/Interrupts/APIC.cpp
index b746fd1bf2..720850898e 100644
--- a/Kernel/Arch/x86_64/Interrupts/APIC.cpp
+++ b/Kernel/Arch/x86_64/Interrupts/APIC.cpp
@@ -205,7 +205,7 @@ void APIC::write_icr(ICRReg const& icr)
#define APIC_LVT_MASKED (1 << 16)
#define APIC_LVT_TRIGGER_LEVEL (1 << 14)
-#define APIC_LVT(iv, dm) (((iv)&0xff) | (((dm)&0x7) << 8))
+#define APIC_LVT(iv, dm) (((iv) & 0xff) | (((dm) & 0x7) << 8))
extern "C" void apic_ap_start(void);
extern "C" u16 apic_ap_start_size;
diff --git a/Kernel/Bus/PCI/Definitions.h b/Kernel/Bus/PCI/Definitions.h
index ede6010fd3..46525ccccc 100644
--- a/Kernel/Bus/PCI/Definitions.h
+++ b/Kernel/Bus/PCI/Definitions.h
@@ -481,16 +481,16 @@ public:
private:
DeviceIdentifier(EnumerableDeviceIdentifier const& other_identifier)
: EnumerableDeviceIdentifier(other_identifier.address(),
- other_identifier.hardware_id(),
- other_identifier.revision_id(),
- other_identifier.class_code(),
- other_identifier.subclass_code(),
- other_identifier.prog_if(),
- other_identifier.subsystem_id(),
- other_identifier.subsystem_vendor_id(),
- other_identifier.interrupt_line(),
- other_identifier.interrupt_pin(),
- other_identifier.capabilities())
+ other_identifier.hardware_id(),
+ other_identifier.revision_id(),
+ other_identifier.class_code(),
+ other_identifier.subclass_code(),
+ other_identifier.prog_if(),
+ other_identifier.subsystem_id(),
+ other_identifier.subsystem_vendor_id(),
+ other_identifier.interrupt_line(),
+ other_identifier.interrupt_pin(),
+ other_identifier.capabilities())
{
}
diff --git a/Kernel/Devices/Storage/SD/SDMemoryCard.cpp b/Kernel/Devices/Storage/SD/SDMemoryCard.cpp
index 8e4a76a8d5..a4359c549c 100644
--- a/Kernel/Devices/Storage/SD/SDMemoryCard.cpp
+++ b/Kernel/Devices/Storage/SD/SDMemoryCard.cpp
@@ -12,7 +12,7 @@ namespace Kernel {
SDMemoryCard::SDMemoryCard(SDHostController& sdhc, StorageDevice::LUNAddress lun_address, u32 hardware_relative_controller_id, u32 block_len, u64 capacity_in_blocks, u32 relative_card_address, SD::OperatingConditionRegister ocr, SD::CardIdentificationRegister cid, SD::SDConfigurationRegister scr)
: StorageDevice(lun_address, hardware_relative_controller_id, block_len,
- capacity_in_blocks)
+ capacity_in_blocks)
, m_sdhc(sdhc)
, m_relative_card_address(relative_card_address)
, m_ocr(ocr)
diff --git a/Kernel/Net/Intel/E1000ENetworkAdapter.cpp b/Kernel/Net/Intel/E1000ENetworkAdapter.cpp
index f94351af88..ca3b128747 100644
--- a/Kernel/Net/Intel/E1000ENetworkAdapter.cpp
+++ b/Kernel/Net/Intel/E1000ENetworkAdapter.cpp
@@ -240,10 +240,10 @@ UNMAP_AFTER_INIT E1000ENetworkAdapter::E1000ENetworkAdapter(StringView interface
NonnullOwnPtr<Memory::Region> tx_buffer_region, NonnullOwnPtr<Memory::Region> rx_descriptors_region,
NonnullOwnPtr<Memory::Region> tx_descriptors_region)
: E1000NetworkAdapter(interface_name, device_identifier, irq, move(registers_io_window),
- move(rx_buffer_region),
- move(tx_buffer_region),
- move(rx_descriptors_region),
- move(tx_descriptors_region))
+ move(rx_buffer_region),
+ move(tx_buffer_region),
+ move(rx_descriptors_region),
+ move(tx_descriptors_region))
{
}
diff --git a/Userland/Libraries/LibC/netinet/in.h b/Userland/Libraries/LibC/netinet/in.h
index 074c0cda51..1dc1da98ae 100644
--- a/Userland/Libraries/LibC/netinet/in.h
+++ b/Userland/Libraries/LibC/netinet/in.h
@@ -50,7 +50,7 @@ static inline uint32_t ntohl(uint32_t value)
#define IN_CLASSA(addr) ((((uint32_t)(addr)) & (128 << 24)) == 0)
#define IN_CLASSB(addr) ((((uint32_t)(addr)) & (192 << 24)) == (128 << 24))
-#define IN_MULTICAST(x) (((x)&0xf0000000) == 0xe0000000)
+#define IN_MULTICAST(x) (((x) & 0xf0000000) == 0xe0000000)
// NOTE: The IPv6 Addressing Scheme that we detect are documented in RFC# 2373.
// See: https://datatracker.ietf.org/doc/html/rfc2373
diff --git a/Userland/Libraries/LibC/sys/param.h b/Userland/Libraries/LibC/sys/param.h
index 319b7f0f76..d86a6e8f39 100644
--- a/Userland/Libraries/LibC/sys/param.h
+++ b/Userland/Libraries/LibC/sys/param.h
@@ -18,5 +18,5 @@
#endif
#ifndef howmany
-# define howmany(x, y) (((x) + ((y)-1)) / (y))
+# define howmany(x, y) (((x) + ((y) - 1)) / (y))
#endif
diff --git a/Userland/Libraries/LibC/syslog.h b/Userland/Libraries/LibC/syslog.h
index 92d97aae40..5e822b1487 100644
--- a/Userland/Libraries/LibC/syslog.h
+++ b/Userland/Libraries/LibC/syslog.h
@@ -30,7 +30,7 @@ struct syslog_data {
/* Macros for masking out the priority of a combined priority */
#define LOG_PRIMASK (7)
-#define LOG_PRI(priority) ((priority)&LOG_PRIMASK)
+#define LOG_PRI(priority) ((priority) & LOG_PRIMASK)
/*
* Many of these facilities don't really make sense anymore, but we keep them
@@ -62,7 +62,7 @@ struct syslog_data {
/* Macros to get the facility from a combined priority. */
#define LOG_FACMASK (~7)
-#define LOG_FAC(priority) (((priority)&LOG_FACMASK) >> 3)
+#define LOG_FAC(priority) (((priority) & LOG_FACMASK) >> 3)
/* For masking logs, we use these macros with just the priority. */
#define LOG_MASK(priority) (1 << (priority))
diff --git a/Userland/Libraries/LibELF/ELFABI.h b/Userland/Libraries/LibELF/ELFABI.h
index 93b75db12e..fa6a8a91de 100644
--- a/Userland/Libraries/LibELF/ELFABI.h
+++ b/Userland/Libraries/LibELF/ELFABI.h
@@ -373,11 +373,11 @@ typedef struct {
/* Extract symbol info - st_info */
#define ELF32_ST_BIND(x) ((x) >> 4)
#define ELF32_ST_TYPE(x) (((unsigned int)x) & 0xf)
-#define ELF32_ST_INFO(b, t) (((b) << 4) + ((t)&0xf))
+#define ELF32_ST_INFO(b, t) (((b) << 4) + ((t) & 0xf))
#define ELF64_ST_BIND(x) ((x) >> 4)
#define ELF64_ST_TYPE(x) (((unsigned int)x) & 0xf)
-#define ELF64_ST_INFO(b, t) (((b) << 4) + ((t)&0xf))
+#define ELF64_ST_INFO(b, t) (((b) << 4) + ((t) & 0xf))
/* Symbol Binding - ELF32_ST_BIND - st_info */
#define STB_LOCAL 0 /* Local symbol */
@@ -399,7 +399,7 @@ typedef struct {
#define STT_HIPROC 15 /* specific symbol types */
/* Extract symbol visibility - st_other */
-#define ELF_ST_VISIBILITY(v) ((v)&0x3)
+#define ELF_ST_VISIBILITY(v) ((v) & 0x3)
#define ELF32_ST_VISIBILITY ELF_ST_VISIBILITY
#define ELF64_ST_VISIBILITY ELF_ST_VISIBILITY
@@ -438,7 +438,7 @@ typedef struct {
} Elf64_Rela;
#define ELF64_R_SYM(info) ((info) >> 32)
-#define ELF64_R_TYPE(info) ((info)&0xFFFFFFFF)
+#define ELF64_R_TYPE(info) ((info) & 0xFFFFFFFF)
#define ELF64_R_INFO(s, t) (((s) << 32) + (uint32_t)(t))
#if defined(__mips64__) && defined(__MIPSEL__)
@@ -451,7 +451,7 @@ typedef struct {
# undef ELF64_R_TYPE
# undef ELF64_R_INFO
# define ELF64_R_TYPE(info) ((uint64_t)swap32((info) >> 32))
-# define ELF64_R_SYM(info) ((info)&0xFFFFFFFF)
+# define ELF64_R_SYM(info) ((info) & 0xFFFFFFFF)
# define ELF64_R_INFO(s, t) (((uint64_t)swap32(t) << 32) + (uint32_t)(s))
#endif /* __mips64__ && __MIPSEL__ */
diff --git a/Userland/Libraries/LibGUI/Model.cpp b/Userland/Libraries/LibGUI/Model.cpp
index 9db04ac838..e0671a7a73 100644
--- a/Userland/Libraries/LibGUI/Model.cpp
+++ b/Userland/Libraries/LibGUI/Model.cpp
@@ -437,13 +437,13 @@ void Model::handle_move(Operation const& operation)
auto replace_handle = [&](ModelIndex const& current_index, int new_dimension, bool relative) {
int new_row = is_row
? (relative
- ? current_index.row() + new_dimension
- : new_dimension)
+ ? current_index.row() + new_dimension
+ : new_dimension)
: current_index.row();
int new_column = !is_row
? (relative
- ? current_index.column() + new_dimension
- : new_dimension)
+ ? current_index.column() + new_dimension
+ : new_dimension)
: current_index.column();
auto new_index = index(new_row, new_column, operation.target_parent);
diff --git a/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp b/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp
index 3dc111295d..a117d73f2e 100644
--- a/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp
+++ b/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp
@@ -426,7 +426,8 @@ bool OS2::use_typographic_metrics() const
Optional<i16> OS2::x_height() const
{
return m_data.visit(
- []<typename T> requires(requires { T::sx_height; })(T * data)->Optional<i16> {
+ []<typename T>
+ requires(requires { T::sx_height; })(T * data) -> Optional<i16> {
return data->sx_height;
},
[](auto*) { return Optional<i16>(); });
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.h b/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.h
index 56afef540c..8547c82272 100644
--- a/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.h
+++ b/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.h
@@ -44,8 +44,8 @@ public:
MathematicalValue(Value value)
: m_value(value.is_number()
- ? value_from_number(value.as_double())
- : ValueType(value.as_bigint().big_integer()))
+ ? value_from_number(value.as_double())
+ : ValueType(value.as_bigint().big_integer()))
{
}
diff --git a/Userland/Libraries/LibJS/Runtime/TypedArray.cpp b/Userland/Libraries/LibJS/Runtime/TypedArray.cpp
index 03c88cedad..af5c6232d2 100644
--- a/Userland/Libraries/LibJS/Runtime/TypedArray.cpp
+++ b/Userland/Libraries/LibJS/Runtime/TypedArray.cpp
@@ -468,8 +468,8 @@ void TypedArrayBase::visit_edges(Visitor& visitor)
\
ClassName::ClassName(Object& prototype, u32 length, ArrayBuffer& array_buffer) \
: TypedArray(prototype, \
- bit_cast<TypedArrayBase::IntrinsicConstructor>(&Intrinsics::snake_name##_constructor), \
- length, array_buffer, Kind::ClassName) \
+ bit_cast<TypedArrayBase::IntrinsicConstructor>(&Intrinsics::snake_name##_constructor), \
+ length, array_buffer, Kind::ClassName) \
{ \
if constexpr (#ClassName##sv.is_one_of("BigInt64Array", "BigUint64Array")) \
m_content_type = ContentType::BigInt; \
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp
index 3e496ea75a..e5d42dca43 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Document.cpp
@@ -3866,7 +3866,7 @@ void Document::shared_declarative_refresh_steps(StringView input, JS::GCPtr<HTML
// 7. Skip ASCII whitespace within input given position.
lexer.ignore_while(Infra::is_ascii_whitespace);
- skip_quotes : {
+ skip_quotes: {
// 8. Skip quotes: If the code point in input pointed to by position is U+0027 (') or U+0022 ("), then let
// quote be that code point, and advance position to the next code point. Otherwise, let quote be the empty
// string.
diff --git a/Userland/Libraries/LibWebSocket/WebSocket.cpp b/Userland/Libraries/LibWebSocket/WebSocket.cpp
index f34c5c1586..e82bbfdd86 100644
--- a/Userland/Libraries/LibWebSocket/WebSocket.cpp
+++ b/Userland/Libraries/LibWebSocket/WebSocket.cpp
@@ -531,7 +531,7 @@ void WebSocket::send_frame(WebSocket::OpCode op_code, ReadonlyBytes payload, boo
{
VERIFY(m_impl);
VERIFY(m_state == WebSocket::InternalState::Open);
- u8 frame_head[1] = { (u8)((is_final ? 0x80 : 0x00) | ((u8)(op_code)&0xf)) };
+ u8 frame_head[1] = { (u8)((is_final ? 0x80 : 0x00) | ((u8)(op_code) & 0xf)) };
m_impl->send(ReadonlyBytes(frame_head, 1));
// Section 5.1 : a client MUST mask all frames that it sends to the server
bool has_mask = true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment