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.

References pg_comp_crc32c, pg_comp_crc32c_sb8(), pg_comp_crc32c_sse42(), and pg_crc32c_sse42_available().

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

◆ pg_crc32c_sse42_available()

static bool pg_crc32c_sse42_available ( void  )
static

Definition at line 34 of file pg_crc32c_sse42_choose.c.

Referenced by pg_comp_crc32c_choose().

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 }

Variable Documentation

◆ pg_comp_crc32c

pg_crc32c(* pg_comp_crc32c) (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().