<commit_before>#define u32 __u32
#define u64 __u64
#define u_int32_t __u32

#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))

#include <stdio.h>
#include <linux/types.h>
#include "initvals.h"

#if 0
static u32 ath9k_hw_print_initval(const u32 *array, u32 rows, u32 columns)
{
	u32 chksum, col, row;

	for (row = 0; row < rows; row++) {
		for (col = 0; col < columns; col++) {
			printf("0x%04x", array[row * columns + col]);
			if (col + 1 < columns)
				printf(", ");
		}
		printf("\n");
	}
}
#endif

static u64 ath9k_hw_check_initval(const u32 *array, u32 rows, u32 columns)
{
	u32 chksum = 0, col, row;

	/*
	 * This checksum stuff is designed for columns <= 8),
	 * and spreads the checksum over 64 bits but since currently
	 * the initval max column size is 6 we only use the first 48
	 * bits.
	 */
	if (columns > 6)
		return 0;

	for (row = 0; row < rows; row++) {
		for (col = 0; col < columns; col++) {
			chksum ^= (array[row * columns + col]) << (8 * col);
		}
	}

	return chksum;
}

int main(void)
{
#define INI_CHECK(_array, _cols) \
		do { \
		chksum = ath9k_hw_check_initval((const u32 *) &_array,\
						ARRAY_SIZE(_array), _cols); \
		printf("0x%016llx        "#_array"\n", chksum); \
		} while (0)

	u64 chksum;

	INI_CHECK(ar5416Modes, 6);
	INI_CHECK(ar5416Common, 2);
	INI_CHECK(ar5416Bank0, 2);
	INI_CHECK(ar5416BB_RfGain, 3);
	INI_CHECK(ar5416Bank1, 2);
	INI_CHECK(ar5416Bank2, 2);
	INI_CHECK(ar5416Bank3, 3);
	INI_CHECK(ar5416Bank6, 3);
	INI_CHECK(ar5416Bank6TPC, 3);
	INI_CHECK(ar5416Bank7, 2);
	INI_CHECK(ar5416Addac, 2);
	INI_CHECK(ar5416Modes_9100, 6);
	INI_CHECK(ar5416Common_9100, 2);
	INI_CHECK(ar5416Bank0_9100, 2);
	INI_CHECK(ar5416BB_RfGain_9100, 3);
	INI_CHECK(ar5416Bank1_9100, 2);
	INI_CHECK(ar5416Bank2_9100, 2);
	INI_CHECK(ar5416Bank3_9100, 3);
	INI_CHECK(ar5416Bank6_9100, 3);
	INI_CHECK(ar5416Bank6TPC_9100, 3);
	INI_CHECK(ar5416Bank7_9100, 2);
	INI_CHECK(ar5416Addac_9100, 2);
	INI_CHECK(ar5416Modes_9160, 6);
	INI_CHECK(ar5416Common_9160, 2);
	INI_CHECK(ar5416Bank0_9160, 2);
	INI_CHECK(ar5416BB_RfGain_9160, 3);<commit_msg>Move the INI_CHECK macro above<commit_after>#define u32 __u32
#define u64 __u64
#define u_int32_t __u32

#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))

#include <stdio.h>
#include <linux/types.h>
#include "initvals.h"

#define INI_CHECK(_array, _cols) \
		do { \
		chksum = ath9k_hw_check_initval((const u32 *) &_array,\
						ARRAY_SIZE(_array), _cols); \
		printf("0x%016llx        "#_array"\n", chksum); \
		} while (0)

#if 0
static u32 ath9k_hw_print_initval(const u32 *array, u32 rows, u32 columns)
{
	u32 chksum, col, row;

	for (row = 0; row < rows; row++) {
		for (col = 0; col < columns; col++) {
			printf("0x%04x", array[row * columns + col]);
			if (col + 1 < columns)
				printf(", ");
		}
		printf("\n");
	}
}
#endif

static u64 ath9k_hw_check_initval(const u32 *array, u32 rows, u32 columns)
{
	u32 chksum = 0, col, row;

	/*
	 * This checksum stuff is designed for columns <= 8),
	 * and spreads the checksum over 64 bits but since currently
	 * the initval max column size is 6 we only use the first 48
	 * bits.
	 */
	if (columns > 6)
		return 0;

	for (row = 0; row < rows; row++) {
		for (col = 0; col < columns; col++) {
			chksum ^= (array[row * columns + col]) << (8 * col);
		}
	}

	return chksum;
}

int main(void)
{
	u64 chksum;

	INI_CHECK(ar5416Modes, 6);
	INI_CHECK(ar5416Common, 2);
	INI_CHECK(ar5416Bank0, 2);
	INI_CHECK(ar5416BB_RfGain, 3);
	INI_CHECK(ar5416Bank1, 2);
	INI_CHECK(ar5416Bank2, 2);
	INI_CHECK(ar5416Bank3, 3);
	INI_CHECK(ar5416Bank6, 3);
	INI_CHECK(ar5416Bank6TPC, 3);
	INI_CHECK(ar5416Bank7, 2);
	INI_CHECK(ar5416Addac, 2);
	INI_CHECK(ar5416Modes_9100, 6);
	INI_CHECK(ar5416Common_9100, 2);
	INI_CHECK(ar5416Bank0_9100, 2);
	INI_CHECK(ar5416BB_RfGain_9100, 3);
	INI_CHECK(ar5416Bank1_9100, 2);
	INI_CHECK(ar5416Bank2_9100, 2);
	INI_CHECK(ar5416Bank3_9100, 3);
	INI_CHECK(ar5416Bank6_9100, 3);
	INI_CHECK(ar5416Bank6TPC_9100, 3);
	INI_CHECK(ar5416Bank7_9100, 2);
	INI_CHECK(ar5416Addac_9100, 2);
	INI_CHECK(ar5416Modes_9160, 6);
	INI_CHECK(ar5416Common_9160, 2);
	INI_CHECK(ar5416Bank0_9160, 2);
	INI_CHECK(ar5416BB_RfGain_9160, 3);
{'fraction_non_alphanumeric': 0.14357743097238895, 'fraction_numerical': 0.129171668667467, 'mean_word_length': 4.668027210884354, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '441418', 'n_tokens_mistral': 2248, 'n_tokens_neox': 1894, 'n_words': 401}