PostgreSQL Source Code  git master
pg_crc32c_sse42_choose.c File Reference
#include "c.h"
#include "port/pg_crc32c.h"
Include dependency graph for pg_crc32c_sse42_choose.c:

Go to the source code of this file.

Functions

static bool pg_crc32c_sse42_available (void)
 
static pg_crc32c pg_comp_crc32c_choose (pg_crc32c crc, const void *data, size_t len)
 

Variables

pg_crc32c(* pg_comp_crc32c )(pg_crc32c crc, const void *data, size_t len) = pg_comp_crc32c_choose
 

Function Documentation

◆ pg_comp_crc32c_choose()

static pg_crc32c pg_comp_crc32c_choose ( pg_crc32c  crc,
const void *  data,
size_t  len 
)
static

Definition at line 54 of file pg_crc32c_sse42_choose.c.

55 {
57  pg_comp_crc32c = pg_comp_crc32c_sse42;
58  else
60 
61  return pg_comp_crc32c(crc, data, len);
62 }
pg_crc32c pg_comp_crc32c_sb8(pg_crc32c crc, const void *data, size_t len)
Definition: pg_crc32c_sb8.c:35
const void size_t len
const void * data
return crc
pg_crc32c(* pg_comp_crc32c)(pg_crc32c crc, const void *data, size_t len)
static bool pg_crc32c_sse42_available(void)

References crc, data, len, pg_comp_crc32c, pg_comp_crc32c_sb8(), and pg_crc32c_sse42_available().

◆ pg_crc32c_sse42_available()

static bool pg_crc32c_sse42_available ( void  )
static

Definition at line 34 of file pg_crc32c_sse42_choose.c.

35 {
36  unsigned int exx[4] = {0, 0, 0, 0};
37 
38 #if defined(HAVE__GET_CPUID)
39  __get_cpuid(1, &exx[0], &exx[1], &exx[2], &exx[3]);
40 #elif defined(HAVE__CPUID)
41  __cpuid(exx, 1);
42 #else
43 #error cpuid instruction not available
44 #endif
45 
46  return (exx[2] & (1 << 20)) != 0; /* SSE 4.2 */
47 }

Referenced by pg_comp_crc32c_choose().

Variable Documentation

◆ pg_comp_crc32c

pg_crc32c(* pg_comp_crc32c) (pg_crc32c crc, const void *data, size_t len) ( pg_crc32c  crc,
const void *  data,
size_t  len 
) = pg_comp_crc32c_choose

Definition at line 64 of file pg_crc32c_sse42_choose.c.

Referenced by pg_comp_crc32c_choose().