HeartLinked commented on code in PR #196: URL: https://github.com/apache/iceberg-cpp/pull/196#discussion_r2303302487
########## src/iceberg/util/endian.h: ########## @@ -0,0 +1,124 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#pragma once + +#include <bit> +#include <concepts> + +/// \file iceberg/util/endian.h +/// \brief Endianness conversion utilities + +namespace iceberg { + +/// \brief Concept for values that can be converted to/from another endian format. +template <typename T> +concept EndianConvertible = std::is_arithmetic_v<T> && !std::same_as<T, bool>; Review Comment: Sizeof(bool) is 1 byte, and endianness is irrelevant for single-byte data types; a byte-swap is a no-op. Also, according to the Iceberg specification, a boolean is represented as 0x00 for false and any non-zero byte for true. This definition is inherently independent of endianness, which is different from multi-byte types like int or double, where the specification explicitly defines the value as being stored in a particular endian format . -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
