summaryrefslogtreecommitdiff
path: root/AK/MACAddress.h
AgeCommit message (Collapse)Author
2020-11-21MACAddress: Use all_of to implement is_zeroLenny Maiorani
Problem: - `is_zero()` is implemented by checking each value in the array by hand. This is error-prone and less expressive than using an algorithm. Solution: - Implement `is_zero()` in terms of `all_of`.
2020-11-20MACAddress: AK::Array as member variable instead of C-arrayLenny Maiorani
Problem: - C-style arrays do not automatically provide bounds checking and are less type safe overall. - `__builtin_memcmp` is not a constant expression in the current gcc. Solution: - Change private m_data to be AK::Array. - Eliminate constructor from C-style array. - Change users of the C-style array constructor to use the default constructor. - Change `operator==()` to be a hand-written comparison loop and let the optimizer figure out to use `memcmp`.
2020-11-19MACAddress: constexpr supportLenny Maiorani
Problem: - `MACAddress` class is not usable in a compile-time context. - `__builtin_memcpy` is not constexpr in gcc. Solution: - Decorate functions with `constexpr` keyword. - Use default constructors and destructors. - Change `__builtin_memcpy` to a hand-written `for` loop and let the compiler's optimizer take care of it. - Add tests to ensure compile-time capabilities.
2020-11-17MACAddress: Unit testing for basic functionalityLenny Maiorani
Problem: - There are no unit tests for `MACAddress` class. This makes it difficult to refactor and ensure the same behavior. - `m_data` private member variable is uninitialized leading to undefined behavior of `is_zero()`. Solution: - Add unit tests to cover basic functionality. - Initialize `m_data`.
2020-10-08AK: Use new format functions.asynts
2020-09-25Meta+AK: Make clang-format-10 cleanBen Wiederhake
2020-04-05Kernel+AK: Separate out MACAddress and move it into AKAnotherTest