Skip to content

Commit

Permalink
[code style] Update a few files to comply with clang-format 17 (#1062)
Browse files Browse the repository at this point in the history
  • Loading branch information
mzhukova authored Aug 7, 2024
1 parent be3ef03 commit f70dc08
Show file tree
Hide file tree
Showing 26 changed files with 153 additions and 135 deletions.
21 changes: 14 additions & 7 deletions examples/low-level-api/crc64_cross_socket_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,17 @@ int get_diff_socket_numa_node_id(qpl_path_t execution_path, int* inv_socket, int

// Print stats
std::cout << "Total:\n";
std::cout << "\t" << "Socket(s):" << total_sockets << "\n";
std::cout << "\t" << "NUMA(s):" << total_nodes << "\n";
std::cout << "\t"
<< "Socket(s):" << total_sockets << "\n";
std::cout << "\t"
<< "NUMA(s):" << total_nodes << "\n";
std::cout << "Current:\n";
std::cout << "\t" << "Core ID:" << cpu_id << "\n";
std::cout << "\t" << "Socket ID:" << socket_id << "\n";
std::cout << "\t" << "NUMA ID:" << numa_id << "\n";
std::cout << "\t"
<< "Core ID:" << cpu_id << "\n";
std::cout << "\t"
<< "Socket ID:" << socket_id << "\n";
std::cout << "\t"
<< "NUMA ID:" << numa_id << "\n";

// Calculate different NUMA node
const int numa_per_socket = total_nodes / total_sockets;
Expand Down Expand Up @@ -243,8 +248,10 @@ auto main(int argc, char** argv) -> int {
int numa_node = -1;
get_diff_socket_numa_node_id(execution_path, &inv_socket, &numa_node);
std::cout << "Running on:\n";
std::cout << "\t" << "Socket ID:" << inv_socket << "\n";
std::cout << "\t" << "NUMA ID:" << numa_node << "\n\n";
std::cout << "\t"
<< "Socket ID:" << inv_socket << "\n";
std::cout << "\t"
<< "NUMA ID:" << numa_node << "\n\n";
std::cout << "This example would be run using accelerator devices from NUMA node " << numa_node << "\n\n";
job->numa_id = numa_node;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ auto main(int argc, char** argv) -> int {
}
}


std::cout << "Content was successfully compressed and decompressed with dictionary.\n";
std::cout << "Input size: " << source.size() << ", compressed size: " << destination.size()
<< ", compression ratio: " << (float)source.size() / (float)destination.size() << ".\n";
Expand Down
28 changes: 14 additions & 14 deletions sources/c_api/legacy_hw_path/hardware_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ extern "C" {
* @{
*/
// opcode_opflags fields
#define ADOF_READ_SRC2(x) (((x)&3U) << 16U) /**< @todo */
#define ADOF_WRITE_SRC2(x) (((x)&3U) << 18U) /**< @todo */
#define ADOF_READ_SRC2(x) (((x) & 3U) << 16U) /**< @todo */
#define ADOF_WRITE_SRC2(x) (((x) & 3U) << 18U) /**< @todo */
#define ADOF_CRC32C (1U << 21U) /**< @todo */
#define ADOF_AECS_SEL (1U << 22U) /**< @todo */
#define ADOF_OPCODE(x) (((x)&0xFFu) << 24U) /**< @todo */
#define ADOF_OPCODE(x) (((x) & 0xFFu) << 24U) /**< @todo */
#define ADOF_GET_OPCODE(x) (((x) >> 24U) & 0xFFu) /**< @todo */

// decompression flags
Expand All @@ -58,21 +58,21 @@ extern "C" {
#define ADDF_SEL_BFINAL_EOB (1U << 4U) /**< @todo */
#define ADDF_DECOMP_BE (1U << 5U) /**< @todo */
#define ADDF_IGNORE_END_BITS(x) \
(((x)&7U) << 6U) /**< This 3-bit flag represents the number of bits
(((x) & 7U) << 6U) /**< This 3-bit flag represents the number of bits
to ignore at the end of the compressed input stream.
Sometimes, a 4th bit may be supported (see below) */
#define ADDF_IGNORE_END_BITS_EXT (1U << 14U) /**< The 4th high-order bit for Ignore End Bits */
#define ADDF_SUPPRESS_OUTPUT (1U << 9U) /**< @todo */
#define ADDF_ENABLE_IDXING(x) (((x)&7U) << 10U) /**< @todo */
#define ADDF_IGNORE_END_BITS_EXT (1U << 14U) /**< The 4th high-order bit for Ignore End Bits */
#define ADDF_SUPPRESS_OUTPUT (1U << 9U) /**< @todo */
#define ADDF_ENABLE_IDXING(x) (((x) & 7U) << 10U) /**< @todo */

// compression flags
#define ADCF_STATS_MODE (1U << 0U) /**< @todo */
#define ADCF_FLUSH_OUTPUT (1U << 1U) /**< @todo */
#define ADCF_END_PROC(x) (((x)&3U) << 2U) /**< @todo */
#define ADCF_COMP_BE (1U << 5U) /**< @todo */
#define ADCF_ENABLE_HDR_GEN(x) (((x)&7U) << 12U) /**< Enable Header Generation */
#define ADCF_WRITE_AECS_HT (1U << 1U) /**< Write AECS Huffman Tables */
#define ADCF_LOAD_DICT(x) (((x)&3U) << 10U) /**< Load dictionary */
#define ADCF_STATS_MODE (1U << 0U) /**< @todo */
#define ADCF_FLUSH_OUTPUT (1U << 1U) /**< @todo */
#define ADCF_END_PROC(x) (((x) & 3U) << 2U) /**< @todo */
#define ADCF_COMP_BE (1U << 5U) /**< @todo */
#define ADCF_ENABLE_HDR_GEN(x) (((x) & 7U) << 12U) /**< Enable Header Generation */
#define ADCF_WRITE_AECS_HT (1U << 1U) /**< Write AECS Huffman Tables */
#define ADCF_LOAD_DICT(x) (((x) & 3U) << 10U) /**< Load dictionary */

// crc64 flags
#define ADC64F_INVCRC (1U << 14U) /**< @todo */
Expand Down
6 changes: 3 additions & 3 deletions sources/core-iaa/include/hw_descriptors_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ static inline HW_PATH_IAA_API(void, descriptor_compress_set_be_output_mode, (hw_
*/
static inline HW_PATH_IAA_API(void, descriptor_compress_set_mini_block_size,
(hw_descriptor* const descriptor_ptr, const hw_iaa_mini_block_size_t mini_block_size)) {
const uint16_t COMPRESSION_FLAG_BIT_MASK = (((uint32_t)(mini_block_size)&7U) << 6U);
const uint16_t COMPRESSION_FLAG_BIT_MASK = (((uint32_t)(mini_block_size) & 7U) << 6U);
const uint8_t COMPRESSION_FLAG_OFFSET = 38U;

*(uint16_t*)(&descriptor_ptr->data[COMPRESSION_FLAG_OFFSET]) |= COMPRESSION_FLAG_BIT_MASK;
Expand All @@ -376,7 +376,7 @@ static inline HW_PATH_IAA_API(void, descriptor_compress_set_mini_block_size,
*/
static inline HW_PATH_IAA_API(void, descriptor_compress_set_termination_rule,
(hw_descriptor* const descriptor_ptr, const hw_iaa_terminator_t terminator)) {
const uint16_t COMPRESSION_FLAG_BIT_MASK = (((terminator)&3U) << 2U);
const uint16_t COMPRESSION_FLAG_BIT_MASK = (((terminator) & 3U) << 2U);
const uint8_t COMPRESSION_FLAG_OFFSET = 38U;

*(uint16_t*)(&descriptor_ptr->data[COMPRESSION_FLAG_OFFSET]) |= COMPRESSION_FLAG_BIT_MASK;
Expand Down Expand Up @@ -460,7 +460,7 @@ HW_PATH_IAA_API(void, descriptor_set_inflate_stop_check_rule,
*/
static inline HW_PATH_IAA_API(void, descriptor_decompress_set_mini_block_size,
(hw_descriptor* const descriptor_ptr, const hw_iaa_mini_block_size_t mini_block_size)) {
const uint16_t DECOMPRESSION_FLAG_BIT_MASK = (((uint32_t)(mini_block_size)&7U) << 10U);
const uint16_t DECOMPRESSION_FLAG_BIT_MASK = (((uint32_t)(mini_block_size) & 7U) << 10U);
const uint8_t DECOMPRESSION_FLAG_OFFSET = 38U;

*(uint16_t*)(&descriptor_ptr->data[DECOMPRESSION_FLAG_OFFSET]) |= DECOMPRESSION_FLAG_BIT_MASK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include "hw_descriptors_api.h"
#include "own_analytic_descriptor.h"

#define OWN_FILTER_FLAGS_SET_SOURCE_1_PARSER(x) (((x)&3U) << 0U) /**< @todo */
#define OWN_FILTER_FLAGS_SET_SOURCE_1_BIT_WIDTH(x) (((x)&0x1FU) << 2U) /**< @todo */
#define OWN_FILTER_FLAGS_SET_OUT_BIT_WIDTH(x) (((x)&3U) << 13U) /**< @todo */
#define OWN_FILTER_FLAGS_SET_SOURCE_1_PARSER(x) (((x) & 3U) << 0U) /**< @todo */
#define OWN_FILTER_FLAGS_SET_SOURCE_1_BIT_WIDTH(x) (((x) & 0x1FU) << 2U) /**< @todo */
#define OWN_FILTER_FLAGS_SET_OUT_BIT_WIDTH(x) (((x) & 3U) << 13U) /**< @todo */
#define OWN_FILTER_FLAGS_GET_SOURCE_1_BIT_WIDTH(x) ((((x) >> 2U) & 0x1FU) + 1) /**< @todo */

HW_PATH_IAA_API(uint32_t, descriptor_get_source1_bit_width, (const hw_descriptor* const descriptor_ptr)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

#define OWN_5_BIT_MASK 0x1fu /**< Mask for 5-bit integer */

#define OWN_FILTER_FLAGS_SET_SOURCE_2_BIT_WIDTH(x) (((x)&0x1FU) << 7U) /**< @todo */
#define OWN_FILTER_FLAGS_SET_SOURCE_2_BE (1U << 12U) /**< @todo */
#define OWN_FILTER_FLAGS_SET_DROP_LOW_BITS(x) (((x)&0x1FU) << 17U) /**< @todo */
#define OWN_FILTER_FLAGS_SET_DROP_HIGH_BITS(x) (((x)&0x1FU) << 22U) /**< @todo */
#define OWN_FILTER_FLAGS_SET_SOURCE_2_BIT_WIDTH(x) (((x) & 0x1FU) << 7U) /**< @todo */
#define OWN_FILTER_FLAGS_SET_SOURCE_2_BE (1U << 12U) /**< @todo */
#define OWN_FILTER_FLAGS_SET_DROP_LOW_BITS(x) (((x) & 0x1FU) << 17U) /**< @todo */
#define OWN_FILTER_FLAGS_SET_DROP_HIGH_BITS(x) (((x) & 0x1FU) << 22U) /**< @todo */

static inline void
own_hw_descriptor_single_source_filter_set_second_source(hw_descriptor* const descriptor_ptr,
Expand Down
32 changes: 16 additions & 16 deletions sources/core-iaa/sources/include/own_hw_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ extern "C" {
* @{
*/
// opcode_opflags fields
#define ADOF_READ_SRC2(x) (((x)&3U) << 16U) /**< @todo */
#define ADOF_WRITE_SRC2(x) (((x)&3U) << 18U) /**< @todo */
#define ADOF_READ_SRC2(x) (((x) & 3U) << 16U) /**< @todo */
#define ADOF_WRITE_SRC2(x) (((x) & 3U) << 18U) /**< @todo */
#define ADOF_CRC32C (1U << 21U) /**< @todo */
#define ADOF_AECS_SEL (1U << 22U) /**< @todo */
#define ADOF_OPCODE(x) (((x)&0xFFU) << 24U) /**< @todo */
#define ADOF_OPCODE(x) (((x) & 0xFFU) << 24U) /**< @todo */
#define ADOF_GET_OPCODE(x) (((x) >> 24U) & 0xFFU) /**< @todo */

// decompression flags
Expand All @@ -78,23 +78,23 @@ extern "C" {
#define ADDF_SEL_BFINAL_EOB (1U << 4U) /**< @todo */
#define ADDF_DECOMP_BE (1U << 5U) /**< @todo */
#define ADDF_IGNORE_END_BITS(x) \
(((x)&7U) << 6U) /**< This 3-bit flag represents the number of bits
(((x) & 7U) << 6U) /**< This 3-bit flag represents the number of bits
to ignore at the end of the compressed input stream.
Sometimes, a 4th bit may be supported (see below) */
#define ADDF_IGNORE_END_BITS_EXT (1U << 14U) /**< The 4th high-order bit for Ignore End Bits */
#define ADDF_SUPPRESS_OUTPUT (1U << 9U) /**< @todo */
#define ADDF_ENABLE_IDXING(x) (((x)&7U) << 10U) /**< @todo */
#define ADDF_IGNORE_END_BITS_EXT (1U << 14U) /**< The 4th high-order bit for Ignore End Bits */
#define ADDF_SUPPRESS_OUTPUT (1U << 9U) /**< @todo */
#define ADDF_ENABLE_IDXING(x) (((x) & 7U) << 10U) /**< @todo */

// compression flags
#define ADCF_STATS_MODE (1U << 0U) /**< @todo */
#define ADCF_FLUSH_OUTPUT (1U << 1U) /**< @todo */
#define ADCF_END_PROC(x) (((x)&3U) << 2U) /**< @todo */
#define ADCF_GEN_LITS (1U << 4U) /**< @todo */
#define ADCF_COMP_BE (1U << 5U) /**< @todo */
#define ADCF_ENABLE_IDXING(x) (((uint32_t)(x)&7U) << 6U) /**< @todo */
#define ADCF_ENABLE_HDR_GEN(x) (((uint32_t)(x)&7U) << 12U) /**< Enable Header Generation */
#define ADCF_WRITE_AECS_HT (1U << 1U) /**< Write AECS Huffman Tables */
#define ADCF_LOAD_DICT(x) (((uint32_t)(x)&3U) << 10U) /**< Load dictionary */
#define ADCF_STATS_MODE (1U << 0U) /**< @todo */
#define ADCF_FLUSH_OUTPUT (1U << 1U) /**< @todo */
#define ADCF_END_PROC(x) (((x) & 3U) << 2U) /**< @todo */
#define ADCF_GEN_LITS (1U << 4U) /**< @todo */
#define ADCF_COMP_BE (1U << 5U) /**< @todo */
#define ADCF_ENABLE_IDXING(x) (((uint32_t)(x) & 7U) << 6U) /**< @todo */
#define ADCF_ENABLE_HDR_GEN(x) (((uint32_t)(x) & 7U) << 12U) /**< Enable Header Generation */
#define ADCF_WRITE_AECS_HT (1U << 1U) /**< Write AECS Huffman Tables */
#define ADCF_LOAD_DICT(x) (((uint32_t)(x) & 3U) << 10U) /**< Load dictionary */

// crc64 flags
#define ADC64F_INVCRC (1U << 14U) /**< @todo */
Expand Down
4 changes: 2 additions & 2 deletions sources/core-sw/dispatcher/dispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ auto get_memory_copy_index(const uint32_t bit_width) -> uint32_t {
return memory_copy_index;
}

auto get_pack_bits_index(const uint32_t flag_be, const uint32_t src_bit_width,
const uint32_t out_bit_width) -> uint32_t {
auto get_pack_bits_index(const uint32_t flag_be, const uint32_t src_bit_width, const uint32_t out_bit_width)
-> uint32_t {
uint32_t pack_array_index = src_bit_width - 1U;
const uint32_t input_be_shift = (flag_be) ? 35 : 0U; // 35
// Unpack function table contains 70 (2 * 35) entries - starts from 1-32 bit-width
Expand Down
6 changes: 3 additions & 3 deletions sources/core-sw/src/filtering/opt/own_store_intrin.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static inline void own_store_8u_LE_tail_kernel(uint8_t* dst_ptr, __mmask64 data,

for (int i = 0; i < dst_align + length; i += 8) {
uint8_t dst = *(dst_ptr + i / 8);
dst &= (align_mask)&0xFF;
dst &= (align_mask) & 0xFF;
dst |= ((data << dst_align) & data_mask) & 0xFF;
*dst_ptr = dst & 0xFF;
align_mask >>= 8;
Expand All @@ -98,7 +98,7 @@ static inline void own_store_16u_LE_tail_kernel(uint8_t* dst_ptr, __mmask32 data

for (int i = 0; i < dst_align + length; i += 8) {
uint8_t dst = *(dst_ptr + i / 8);
dst &= (align_mask)&0xFF;
dst &= (align_mask) & 0xFF;
dst |= ((data << dst_align) & data_mask) & 0xFF;
*dst_ptr = dst & 0xFF;
align_mask >>= 8;
Expand All @@ -124,7 +124,7 @@ static inline void own_store_32u_LE_tail_kernel(uint8_t* dst_ptr, __mmask16 data

for (int i = 0; i < dst_align + length; i += 8) {
uint8_t dst = *(dst_ptr + i / 8);
dst &= (align_mask)&0xFF;
dst &= (align_mask) & 0xFF;
dst |= ((data << dst_align) & data_mask) & 0xFF;
*dst_ptr = dst & 0xFF;
align_mask >>= 8;
Expand Down
56 changes: 28 additions & 28 deletions sources/core-sw/src/include/own_qplc_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,34 +70,34 @@ extern "C" {
*/

#define QPL_ONE_64U (1ULL)
#define OWN_MAX_16U 0xFFFF /**< Max value for uint16_t */
#define OWN_MAX_32U 0xFFFFFFFF /**< Max value for uint32_t */
#define OWN_1_BIT_MASK 1U /**< Mask for 1-bit integer */
#define OWN_2_BIT_MASK 3U /**< Mask for 2-bit integer */
#define OWN_3_BIT_MASK 7U /**< Mask for 3-bit integer */
#define OWN_4_BIT_MASK 0xFU /**< Mask for 4-bit integer */
#define OWN_5_BIT_MASK 0x1FU /**< Mask for 5-bit integer */
#define OWN_6_BIT_MASK 0x3FU /**< Mask for 6-bit integer */
#define OWN_7_BIT_MASK 0x7FU /**< Mask for 7-bit integer */
#define OWN_HIGH_BIT_MASK 0x80U /**< Mask for most significant bit in a byte */
#define OWN_LOW_BIT_MASK 1U /**< Mask for least significant bit in a byte */
#define OWN_BYTE_WIDTH 8U /**< Byte width in bits */
#define OWN_WORD_WIDTH 16U /**< Word width in bits */
#define OWN_3_BYTE_WIDTH 24U /**< 3-byte width in bits */
#define OWN_DWORD_WIDTH 32U /**< Dword width in bits */
#define OWN_6_BYTE_WIDTH 48U /**< 6-byte width in bits */
#define OWN_7_BYTE_WIDTH 56U /**< 7-byte width in bits */
#define OWN_QWORD_WIDTH 64U /**< Qword width in bits */
#define OWN_BIT_MASK(x) ((QPL_ONE_64U << (x)) - 1U) /**< Bit mask below bit position */
#define OWN_PARQUET_WIDTH 8U /**< Parquet size in elements (PRLE format) */
#define OWN_LITERAL_OCTA_GROUP 1U /**< PRLE format description */
#define OWN_VARINT_BYTE_1(x) (((x)&OWN_7_BIT_MASK) << 6U) /**< 1st byte extraction for varint format */
#define OWN_VARINT_BYTE_2(x) (((x)&OWN_7_BIT_MASK) << 13U) /**< 2nd byte extraction for varint format */
#define OWN_VARINT_BYTE_3(x) (((x)&OWN_7_BIT_MASK) << 20U) /**< 3rd byte extraction for varint format */
#define OWN_VARINT_BYTE_4(x) (((x)&OWN_5_BIT_MASK) << 27U) /**< 4th byte extraction for varint format */
#define OWN_PRLE_COUNT(x) (((x)&OWN_7_BIT_MASK) >> 1U) /**< PRLE count field extraction */
#define OWN_MAX(a, b) (((a) > (b)) ? (a) : (b)) /**< Maximum from 2 values */
#define OWN_MIN(a, b) (((a) < (b)) ? (a) : (b)) /**< Minimum from 2 values */
#define OWN_MAX_16U 0xFFFF /**< Max value for uint16_t */
#define OWN_MAX_32U 0xFFFFFFFF /**< Max value for uint32_t */
#define OWN_1_BIT_MASK 1U /**< Mask for 1-bit integer */
#define OWN_2_BIT_MASK 3U /**< Mask for 2-bit integer */
#define OWN_3_BIT_MASK 7U /**< Mask for 3-bit integer */
#define OWN_4_BIT_MASK 0xFU /**< Mask for 4-bit integer */
#define OWN_5_BIT_MASK 0x1FU /**< Mask for 5-bit integer */
#define OWN_6_BIT_MASK 0x3FU /**< Mask for 6-bit integer */
#define OWN_7_BIT_MASK 0x7FU /**< Mask for 7-bit integer */
#define OWN_HIGH_BIT_MASK 0x80U /**< Mask for most significant bit in a byte */
#define OWN_LOW_BIT_MASK 1U /**< Mask for least significant bit in a byte */
#define OWN_BYTE_WIDTH 8U /**< Byte width in bits */
#define OWN_WORD_WIDTH 16U /**< Word width in bits */
#define OWN_3_BYTE_WIDTH 24U /**< 3-byte width in bits */
#define OWN_DWORD_WIDTH 32U /**< Dword width in bits */
#define OWN_6_BYTE_WIDTH 48U /**< 6-byte width in bits */
#define OWN_7_BYTE_WIDTH 56U /**< 7-byte width in bits */
#define OWN_QWORD_WIDTH 64U /**< Qword width in bits */
#define OWN_BIT_MASK(x) ((QPL_ONE_64U << (x)) - 1U) /**< Bit mask below bit position */
#define OWN_PARQUET_WIDTH 8U /**< Parquet size in elements (PRLE format) */
#define OWN_LITERAL_OCTA_GROUP 1U /**< PRLE format description */
#define OWN_VARINT_BYTE_1(x) (((x) & OWN_7_BIT_MASK) << 6U) /**< 1st byte extraction for varint format */
#define OWN_VARINT_BYTE_2(x) (((x) & OWN_7_BIT_MASK) << 13U) /**< 2nd byte extraction for varint format */
#define OWN_VARINT_BYTE_3(x) (((x) & OWN_7_BIT_MASK) << 20U) /**< 3rd byte extraction for varint format */
#define OWN_VARINT_BYTE_4(x) (((x) & OWN_5_BIT_MASK) << 27U) /**< 4th byte extraction for varint format */
#define OWN_PRLE_COUNT(x) (((x) & OWN_7_BIT_MASK) >> 1U) /**< PRLE count field extraction */
#define OWN_MAX(a, b) (((a) > (b)) ? (a) : (b)) /**< Maximum from 2 values */
#define OWN_MIN(a, b) (((a) < (b)) ? (a) : (b)) /**< Minimum from 2 values */
#ifndef UNREFERENCED_PARAMETER
#ifdef __GNUC__
#define UNREFERENCED_PARAMETER(p) p __attribute__((unused)) /**< Unreferenced parameter - warning removal */
Expand Down
2 changes: 1 addition & 1 deletion sources/isal/igzip/huff_codes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1479,7 +1479,7 @@ static void expand_hufftables_icf(struct hufftables_icf* hufftables) {
p_code++;
}
} // end for k
} // end for eb
} // end for eb
// fix up last record
p_code[-1] = orig[i];

Expand Down
Loading

0 comments on commit f70dc08

Please sign in to comment.