Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
LEndianBytesToInt
and BEndianBytesToInt
compatible with `u8s…
…tring_view` (pixie-io#1592) Summary: Make `LEndianBytesToInt` and `BEndianBytesToInt` compatible with `u8string_view` In order to parse Go's buildinfo header, we need to convert bytes contained within a [u8string_view](https://github.com/pixie-io/pixie/blob/c092058a5172396ea9bead1e209c2ed4e2336943/src/common/base/byte_utils.h#L30-L31) (return values from [ElfReader](https://github.com/pixie-io/pixie/blob/c092058a5172396ea9bead1e209c2ed4e2336943/src/stirling/obj_tools/elf_reader.cc#L608)). This PR adds template specializations to the existing `LEndianBytesToInt` and `BEndianBytesToInt` functions so they are compatible with the `u8string_view` data type. This will allow the code that will eventually parse a Go buildinfo header to be cleaner by preventing an explicit conversion via `CreateStringView` as seen in [this commit](pixie-io@ae5dd20#diff-a5cd29c11ef9bc8c2ae92c1eb15bdace92d54e4e634fe5889a64979bd272e0b8R109-R110). Relevant Issues: pixie-io#1300 pixie-io#1318 Type of change: /kind feature Test Plan: Verified that the new test cases fail to compile without this change and that this interface is more compatible for code linked above. Signed-off-by: Dom Del Nano <ddelnano@pixielabs.ai>
- Loading branch information