PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
pg_crc32c_choose.c File Reference
#include "c.h"
#include "port/pg_crc32c.h"
Include dependency graph for pg_crc32c_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

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

Definition at line 53 of file pg_crc32c_choose.c.

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

54 {
57  else
59 
60  return pg_comp_crc32c(crc, data, len);
61 }
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)(pg_crc32c crc, const void *data, size_t len)
pg_crc32c pg_comp_crc32c_sse42(pg_crc32c crc, const void *data, size_t len)
static bool pg_crc32c_sse42_available(void)
static bool pg_crc32c_sse42_available ( void  )
static

Definition at line 33 of file pg_crc32c_choose.c.

Referenced by pg_comp_crc32c_choose().

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

Variable Documentation

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

Definition at line 63 of file pg_crc32c_choose.c.

Referenced by pg_comp_crc32c_choose().