Commit graph

8 commits

Author SHA1 Message Date
sin-ack 05c3755e62 AK: Add formatters for BigEndian and LittleEndian
This allows printing out BigEndian and LittleEndian values without
having to perform a static_cast first.
2021-08-02 00:25:11 +02:00
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Lenny Maiorani e6f907a155 AK: Simplify constructors and conversions from nullptr_t
Problem:
- Many constructors are defined as `{}` rather than using the ` =
  default` compiler-provided constructor.
- Some types provide an implicit conversion operator from `nullptr_t`
  instead of requiring the caller to default construct. This violates
  the C++ Core Guidelines suggestion to declare single-argument
  constructors explicit
  (https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c46-by-default-declare-single-argument-constructors-explicit).

Solution:
- Change default constructors to use the compiler-provided default
  constructor.
- Remove implicit conversion operators from `nullptr_t` and change
  usage to enforce type consistency without conversion.
2021-01-12 09:11:45 +01:00
Linus Groh bbe787a0af Everywhere: Re-format with clang-format-11
Compared to version 10 this fixes a bunch of formatting issues, mostly
around structs/classes with attributes like [[gnu::packed]], and
incorrect insertion of spaces in parameter types ("T &"/"T &&").
I also removed a bunch of // clang-format off/on and FIXME comments that
are no longer relevant - on the other hand it tried to destroy a couple of
neatly formatted comments, so I had to add some as well.
2020-12-31 21:51:00 +01:00
Andrew Kaster 02fcf3974e AK/Userland: Use AK/Endian.h for portable byte swapping in ntpquery
Create macros for the byte swap operations one would expect to be in
endian.h or byteswap.h in AK/Endian.h. It's likely a similar/different
change will be needed for BSDs, but there's no github action for those
added to the project yet.
2020-12-28 19:35:32 +01:00
Lenny Maiorani 151b8b5984 Endian: constexpr constructors and conversion operators
Problem:
- Constructors and conversion operators are not `constexpr`,
  but they can be.
- `constexpr` is needed here so that other classes can add `constexpr`
  evaluation.

Solution:
- Add the `constexpr` keyword to the constructors and
  conversion operators.
- Add `static_assert` tests which ensure the capability works.
2020-10-08 23:28:54 +02:00
asynts e68b158a52 AK: Don't swap endianness when writing endian wrappers to stream. 2020-08-29 17:44:34 +02:00
asynts 10c6f062b3 AK: Add Endian.h header to replace NetworkOrdered.h. 2020-08-25 16:22:14 +02:00