Skip to content

Commit

Permalink
t1ha: reformat by clang-format-6.0 (cosmetic).
Browse files Browse the repository at this point in the history
  • Loading branch information
erthink committed Jun 21, 2018
1 parent 8bc850d commit 236f308
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 85 deletions.
8 changes: 4 additions & 4 deletions src/t1ha0_ia32aes_a.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ uint64_t T1HA_IA32AES_NAME(const void *data, size_t len, uint64_t seed) {
#endif
#else
#if defined(__SSE4_1__) || defined(__AVX__)
a = (uint32_t)_mm_extract_epi32(x, 0) |
(uint64_t)_mm_extract_epi32(x, 1) << 32;
b = (uint32_t)_mm_extract_epi32(x, 2) |
(uint64_t)_mm_extract_epi32(x, 3) << 32;
a = (uint32_t)_mm_extract_epi32(x, 0) | (uint64_t)_mm_extract_epi32(x, 1)
<< 32;
b = (uint32_t)_mm_extract_epi32(x, 2) | (uint64_t)_mm_extract_epi32(x, 3)
<< 32;
#else
a = (uint32_t)_mm_cvtsi128_si32(x);
a |= (uint64_t)_mm_cvtsi128_si32(_mm_shuffle_epi32(x, 1)) << 32;
Expand Down
8 changes: 4 additions & 4 deletions src/t1ha0_ia32aes_b.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ uint64_t T1HA_IA32AES_NAME(const void *data, size_t len, uint64_t seed) {
#endif
#else
#if defined(__SSE4_1__) || defined(__AVX__)
a = (uint32_t)_mm_extract_epi32(x, 0) |
(uint64_t)_mm_extract_epi32(x, 1) << 32;
b = (uint32_t)_mm_extract_epi32(x, 2) |
(uint64_t)_mm_extract_epi32(x, 3) << 32;
a = (uint32_t)_mm_extract_epi32(x, 0) | (uint64_t)_mm_extract_epi32(x, 1)
<< 32;
b = (uint32_t)_mm_extract_epi32(x, 2) | (uint64_t)_mm_extract_epi32(x, 3)
<< 32;
#else
a = (uint32_t)_mm_cvtsi128_si32(x);
a |= (uint64_t)_mm_cvtsi128_si32(_mm_shuffle_epi32(x, 1)) << 32;
Expand Down
3 changes: 1 addition & 2 deletions tests/mera.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
#include <errno.h>
#include <fcntl.h>
#include <setjmp.h>
#include <setjmp.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
Expand Down Expand Up @@ -1160,7 +1159,7 @@ bool mera_init(void) {
"gettimeofday()", "ns");
#endif /* Windows */

/***************************************************************************/
/***************************************************************************/

#ifndef __native_client__
#if defined(__elbrus__) || defined(__e2k__)
Expand Down
12 changes: 9 additions & 3 deletions tests/mera.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,19 @@ typedef struct _ia32_cpu_features {
uint32_t ebx;
uint32_t ecx;
uint32_t edx;
} basic /* https://en.wikipedia.org/wiki/CPUID#EAX=1:_Processor_Info_and_Feature_Bits */,
extended_7 /* https://en.wikipedia.org/wiki/CPUID#EAX=7,_ECX=0:_Extended_Features */;
} basic /* https://en.wikipedia.org/wiki/CPUID#EAX=1:_Processor_Info_and_Feature_Bits
*/
,
extended_7 /* https://en.wikipedia.org/wiki/CPUID#EAX=7,_ECX=0:_Extended_Features
*/
;

struct {
uint32_t ecx;
uint32_t edx;
} extended_80000001 /* https://en.wikipedia.org/wiki/CPUID#EAX=80000001h:_Extended_Processor_Info_and_Feature_Bits */;
} extended_80000001 /* https://en.wikipedia.org/wiki/CPUID#EAX=80000001h:_Extended_Processor_Info_and_Feature_Bits
*/
;

struct {
uint32_t ecx;
Expand Down
126 changes: 64 additions & 62 deletions tests/xxhash/xxhash.c
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
/*
* xxHash - Fast Hash algorithm
* Copyright (C) 2012-2016, Yann Collet
*
* BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* You can contact the author at :
* - xxHash homepage: http://www.xxhash.com
* - xxHash source repository : https://github.com/Cyan4973/xxHash
*/
* xxHash - Fast Hash algorithm
* Copyright (C) 2012-2016, Yann Collet
*
* BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* You can contact the author at :
* - xxHash homepage: http://www.xxhash.com
* - xxHash source repository : https://github.com/Cyan4973/xxHash
*/

/* *************************************
* Tuning parameters
***************************************/
* Tuning parameters
***************************************/
/*!XXH_FORCE_MEMORY_ACCESS :
* By default, access to unaligned memory is controlled by `memcpy()`, which is
* safe and portable.
Expand Down Expand Up @@ -120,11 +120,11 @@
#endif /* MSVC */

/* *************************************
* Includes & Memory related functions
***************************************/
* Includes & Memory related functions
***************************************/
/*! Modify the local functions below should you wish to use some other memory
* routines
* for malloc(), free() */
* routines
* for malloc(), free() */
#include <stdlib.h>
static void *XXH_malloc(size_t s) { return malloc(s); }
static void XXH_free(void *p) { free(p); }
Expand All @@ -140,8 +140,8 @@ static void *XXH_memcpy(void *dest, const void *src, size_t size) {
#include "xxhash.h"

/* *************************************
* Compiler Specific Options
***************************************/
* Compiler Specific Options
***************************************/
#ifdef _MSC_VER /* Visual Studio */
#pragma warning( \
disable : 4127) /* disable: C4127: conditional expression is constant */
Expand All @@ -160,8 +160,8 @@ static void *XXH_memcpy(void *dest, const void *src, size_t size) {
#endif

/* *************************************
* Basic Types
***************************************/
* Basic Types
***************************************/
#ifndef MEM_MODULE
#if !defined(__VMS) && \
(defined(__cplusplus) || \
Expand All @@ -188,7 +188,9 @@ static U32 XXH_read32(const void *memPtr) { return *(const U32 *)memPtr; }
/* __pack instructions are safer, but compiler specific, hence potentially
* problematic for some compilers */
/* currently only defined for gcc and icc */
typedef union { U32 u32; } __attribute__((packed)) unalign;
typedef union {
U32 u32;
} __attribute__((packed)) unalign;
static U32 XXH_read32(const void *ptr) { return ((const unalign *)ptr)->u32; }

#else
Expand All @@ -205,8 +207,8 @@ static U32 XXH_read32(const void *memPtr) {
#endif /* XXH_FORCE_DIRECT_MEMORY_ACCESS */

/* ****************************************
* Compiler-specific Functions and Macros
******************************************/
* Compiler-specific Functions and Macros
******************************************/
#define XXH_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)

/* Note : although _rotl exists for minGW (GCC under windows), performance seems
Expand All @@ -231,8 +233,8 @@ static U32 XXH_swap32(U32 x) {
#endif

/* *************************************
* Architecture Macros
***************************************/
* Architecture Macros
***************************************/
typedef enum { XXH_bigEndian = 0, XXH_littleEndian = 1 } XXH_endianess;

/* XXH_CPU_LITTLE_ENDIAN can be defined externally, for example on the compiler
Expand All @@ -249,8 +251,8 @@ static int XXH_isLittleEndian(void) {
#endif

/* ***************************
* Memory reads
*****************************/
* Memory reads
*****************************/
typedef enum { XXH_aligned, XXH_unaligned } XXH_alignment;

FORCE_INLINE U32 XXH_readLE32_align(const void *ptr, XXH_endianess endian,
Expand All @@ -272,17 +274,17 @@ static U32 XXH_readBE32(const void *ptr) {
}

/* *************************************
* Macros
***************************************/
* Macros
***************************************/
#define XXH_STATIC_ASSERT(c) \
{ \
enum { XXH_sa = 1 / (int)(!!(c)) }; \
} /* use after variable declarations */
XXH_PUBLIC_API unsigned XXH_versionNumber(void) { return XXH_VERSION_NUMBER; }

/* *******************************************************************
* 32-bit hash functions
*********************************************************************/
* 32-bit hash functions
*********************************************************************/
static const U32 PRIME32_1 = 2654435761U;
static const U32 PRIME32_2 = 2246822519U;
static const U32 PRIME32_3 = 3266489917U;
Expand Down Expand Up @@ -595,13 +597,13 @@ XXH_PUBLIC_API unsigned int XXH32_digest(const XXH32_state_t *state_in) {
/*====== Canonical representation ======*/

/*! Default XXH result types are basic unsigned 32 and 64 bits.
* The canonical representation follows human-readable write convention, aka
* big-endian (large digits first).
* These functions allow transformation of hash result into and from its
* canonical format.
* This way, hash values can be written into a file or buffer, remaining
* comparable across different systems.
*/
* The canonical representation follows human-readable write convention, aka
* big-endian (large digits first).
* These functions allow transformation of hash result into and from its
* canonical format.
* This way, hash values can be written into a file or buffer, remaining
* comparable across different systems.
*/

XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t *dst,
XXH32_hash_t hash) {
Expand All @@ -619,8 +621,8 @@ XXH32_hashFromCanonical(const XXH32_canonical_t *src) {
#ifndef XXH_NO_LONG_LONG

/* *******************************************************************
* 64-bit hash functions
*********************************************************************/
* 64-bit hash functions
*********************************************************************/

/*====== Memory access ======*/

Expand Down
24 changes: 14 additions & 10 deletions tests/xxhash/xxhash.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ extern "C" {
#endif

/* ****************************
* Definitions
******************************/
* Definitions
******************************/
#include <stddef.h> /* size_t */
typedef enum { XXH_OK = 0, XXH_ERROR } XXH_errorcode;

Expand Down Expand Up @@ -154,8 +154,8 @@ typedef enum { XXH_OK = 0, XXH_ERROR } XXH_errorcode;
#endif

/* *************************************
* Version
***************************************/
* Version
***************************************/
#define XXH_VERSION_MAJOR 0
#define XXH_VERSION_MINOR 6
#define XXH_VERSION_RELEASE 5
Expand All @@ -165,8 +165,8 @@ typedef enum { XXH_OK = 0, XXH_ERROR } XXH_errorcode;
XXH_PUBLIC_API unsigned XXH_versionNumber(void);

/*-**********************************************************************
* 32-bit hash
************************************************************************/
* 32-bit hash
************************************************************************/
typedef unsigned int XXH32_hash_t;

/*! XXH32() :
Expand Down Expand Up @@ -221,7 +221,9 @@ XXH_PUBLIC_API XXH32_hash_t XXH32_digest(const XXH32_state_t *statePtr);

/*====== Canonical representation ======*/

typedef struct { unsigned char digest[4]; } XXH32_canonical_t;
typedef struct {
unsigned char digest[4];
} XXH32_canonical_t;
XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t *dst,
XXH32_hash_t hash);
XXH_PUBLIC_API XXH32_hash_t
Expand All @@ -238,8 +240,8 @@ XXH32_hashFromCanonical(const XXH32_canonical_t *src);

#ifndef XXH_NO_LONG_LONG
/*-**********************************************************************
* 64-bit hash
************************************************************************/
* 64-bit hash
************************************************************************/
typedef unsigned long long XXH64_hash_t;

/*! XXH64() :
Expand All @@ -266,7 +268,9 @@ XXH_PUBLIC_API XXH_errorcode XXH64_update(XXH64_state_t *statePtr,
XXH_PUBLIC_API XXH64_hash_t XXH64_digest(const XXH64_state_t *statePtr);

/*====== Canonical representation ======*/
typedef struct { unsigned char digest[8]; } XXH64_canonical_t;
typedef struct {
unsigned char digest[8];
} XXH64_canonical_t;
XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t *dst,
XXH64_hash_t hash);
XXH_PUBLIC_API XXH64_hash_t
Expand Down

0 comments on commit 236f308

Please sign in to comment.