VLFeat - Documentation > C API

# VLFeat.org

Documentation> C API

- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

Functions
host.h File Reference

Host. More...

## Macros

Configuration options
#define | VL_DISABLE_THREADS
| Defined if multi-threading support is disabled. More...
#define | VL_DISABLE_SSE2
| Defined if SSE2 support if disabled. More...
#define | VL_DISABLE_OPENMP
| Defined if OpenMP support is disabled. More...
Defining functions
#define | VL_EXPORT
| Declares a DLL exported symbol. More...
#define | VL_INLINE
| Adds appropriate inline function qualifier. More...
C preprocessor helper macros
#define | VL_STRINGIFY(x) # x
| Convert the argument to a string. More...
#define | VL_XSTRINGIFY(x) VL_STRINGIFY(x)
| Expand and then convert the argument to a string. More...
#define | VL_CAT(x, y) x ## y
| Concatenate two arguments into a lexical unit. More...
#define | VL_XCAT(x, y) VL_CAT(x,y)
| Expand and then concatenate two arguments into a lexical unit. More...
#define | VL_XCAT3(x, y, z) VL_XCAT(VL_XCAT(x,y),z)
| Expand and then concatenate three arguments into a lexical unit. More...
#define | VL_XCAT4(x, y, z, u) VL_XCAT(VL_XCAT3(x,y,z),u)
| Expand and then concatenate four arguments into a lexical unit. More...
#define | VL_XCAT5(x, y, z, u, v) VL_XCAT(VL_XCAT4(x,y,z,u),v)
| Expand and then concatenate five arguments into a lexical unit. More...
#define | VL_YESNO(x) ((x)?"yes":"no")
| Convert a boolean to "yes" or "no" strings. More...
Identifying the host operating system
#define | VL_OS_LINUX 1
| Defined if the host operating system is Linux.
#define | VL_OS_MACOSX 1
| Defined if the host operating system is Mac OS X.
#define | VL_OS_WIN 1
| Defined if the host operating system is Windows (32 or 64)
#define | VL_OS_WIN64 1
| Defined if the host operating system is Windows-64.
Identifying the host threading library
#define | VL_THREADS_POSIX 1
| Defiend if the host uses POISX threads. More...
#define | VL_THREADS_WIN 1
| Defined if the host uses Windows threads. More...
Identifying the host compiler
#define | VL_COMPILER_GNUC
| Defined if the host compiler is GNU C. More...
#define | VL_COMPILER_MSC _MSC_VER
| Defined if the host compiler is Microsoft Visual C++. More...
#define | VL_COMPILER_LCC 1
| Defined if the host compiler is LCC. More...
Identifying the host CPU architecture
#define | VL_ARCH_IX86 300
| Defined if the host CPU is of the Intel x86 family. More...
#define | VL_ARCH_IA64
| Defined if the host CPU is of the Intel Architecture-64 family. More...
Identifying the host data model
#define | VL_COMPILER_LLP64
| Defined if the host compiler data model is LLP64. More...
#define | VL_COMPILER_LP64
| Defined if the host compiler data model is LP64. More...
#define | VL_COMPILER_ILP32
| Defined if the host compiler data model is ILP32. More...
Identifying the host endianness
#define | VL_ARCH_LITTLE_ENDIAN
| Defined if the host CPU is little endian. More...
#define | VL_ARCH_BIG_ENDIAN
| Defined if the host CPU is big endian. More...
Creating integer constants
#define | VL_INT8_C(x) x
| Create an integer constant of the specified width and sign. More...
#define | VL_INT16_C(x) x
| Create an integer constant of the specified width and sign. More...
#define | VL_INT32_C(x) x
| Create an integer constant of the specified width and sign. More...
#define | VL_INT64_C(x) x ## L
| Create an integer constant of the specified width and sign. More...
#define | VL_UINT8_C(x) x
| Create an integer constant of the specified width and sign. More...
#define | VL_UINT16_C(x) x
| Create an integer constant of the specified width and sign. More...
#define | VL_UINT32_C(x) x ## U
| Create an integer constant of the specified width and sign. More...
#define | VL_UINT64_C(x) x ## UL
| Create an integer constant of the specified width and sign. More...
Printing the atomic data types
#define | VL_FL_INT64 "I64"
| `printf` length flag for vl_int64 and vl_uint64.
#define | VL_FL_INT32 ""
| `printf` length flag for vl_int32 and vl_uint32.
#define | VL_FL_INT16 "h"
| `printf` length flag for vl_int16 and vl_uint16.
#define | VL_FL_INT8 "hh"
| `printf` length flag for vl_int8 and vl_uint8.
#define | VL_FL_INDEX VL_FL_INT64
| `printf` length flag for vl_index and vl_uindex
#define | VL_FL_INDEX VL_FL_INT32
| `printf` length flag for vl_index and vl_uindex
#define | VL_FMT_INDEX VL_FL_INDEX "d"
| `printf` flag for vl_index
#define | VL_FMT_INTPTR VL_FMT_INDEX
| `printf` flag for vl_intptr
#define | VL_FMT_UINDEX VL_FL_INDEX "u"
| `printf` flag for vl_uindex
#define | VL_FMT_SIZE VL_FMT_UINDEX
| `printf` flag for vl_size
#define | VL_FMT_UINTPTR VL_FMT_UINDEX
| `printf` flag for vl_uintptr
Atomic data types limits
#define | VL_BIG_INT 0x7FFFFFFFL
| Largest integer (math constant)
#define | VL_SMALL_INT (- VL_BIG_INT - 1)
| Smallest integer (math constant)
#define | VL_BIG_UINT 0xFFFFFFFFUL
| Largest unsigned integer (math constant)

## Functions

char * | vl_static_configuration_to_string_copy ()
| Human readable static library configuration. More...
Endianness detection and conversion
void | vl_swap_host_big_endianness_8 (void *dst, void *src)
| Host <-> big endian transformation for 8-bytes value. More...
void | vl_swap_host_big_endianness_4 (void *dst, void *src)
| Host <-> big endian transformation for 4-bytes value. More...
void | vl_swap_host_big_endianness_2 (void *dst, void *src)
| Host <-> big endian transformation for 2-bytes value. More...
Obtaining host info at run time
void | _vl_x86cpu_info_init (VlX86CpuInfo *self)
char * | _vl_x86cpu_info_to_string_copy (VlX86CpuInfo const *self)

## Atomic data types

#define | VL_TRUE 1
| `true` (1) constant
#define | VL_FALSE 0
| `false` (0) constant
typedef long long | vl_int64
| Signed 64-bit integer.
typedef int | vl_int32
| Signed 32-bit integer.
typedef short | vl_int16
| Signed 16-bit integer.
typedef char | vl_int8
| Signed 8-bit integer.
typedef long long unsigned | vl_uint64
| Unsigned 64-bit integer.
typedef int unsigned | vl_uint32
| Unsigned 32-bit integer.
typedef short unsigned | vl_uint16
| Unsigned 16-bit integer.
typedef char unsigned | vl_uint8
| Unsigned 8-bit integer.
typedef int | vl_int
| Same as `int`.
typedef unsigned int | vl_uint
| Same as `unsigned int`.
typedef int | vl_bool
| Boolean.
typedef vl_int64 | vl_intptr
| Integer holding a pointer.
typedef vl_uint64 | vl_uintptr
| Unsigned integer holding a pointer.
typedef vl_uint64 | vl_size
| Unsigned integer holding the size of a memory block.
typedef vl_int64 | vl_index
| Signed version of vl_size and vl_uindex.
typedef vl_uint64 | vl_uindex
| Same as vl_size.

## Detailed Description

Author
  Andrea Vedaldi

See also
  Portability features

## Macro Definition Documentation

#define VL_ARCH_BIG_ENDIAN

See also
  Endianness

#define VL_ARCH_IA64

See also
  Host CPU architecture

#define VL_ARCH_IX86 300

See also
  Host CPU architecture

#define VL_ARCH_LITTLE_ENDIAN

See also
  Endianness

#define VL_CAT | ( |  | x,
|  |  | y
| ) |  | x ## y

Parameters

  x | first argument to be concatenated.
  y | second argument to be concatenated.

This macro concatenates its arguments into a single lexical unit by means of the `##` preprocessor operator. Notice that arguments concatenated by `##` are not pre-expanded by the C preprocessor. To macro-expand the arguments and then concatenate them,use VL_XCAT.

See also
  VL_XCAT

#define VL_COMPILER_GNUC

Value:
(__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100)

This macro is defined if the compiler is GNUC. Its value is calculated as

10000 * MAJOR + 100 * MINOR + PATCHLEVEL

See also
  Host compiler

#define VL_COMPILER_ILP32

See also
  Data models

#define VL_COMPILER_LCC 1

Deprecated:
  The LCC is not supported anymore.
  See also
    Host compiler

#define VL_COMPILER_LLP64

See also
  Data models

#define VL_COMPILER_LP64

See also
  Data models

#define VL_COMPILER_MSC _MSC_VER

See also
  Host compiler

#define VL_DISABLE_OPENMP

Define this symbol during compilation of the library and linking to another project to disable VLFeat OpenMP support.

#define VL_DISABLE_SSE2

Define this symbol during compliation of the library and linking to another project to disable VLFeat SSE2 support.

#define VL_DISABLE_THREADS

Define this symbol during compilation of the library and linking to another project to disable VLFeat multi-threading support.

#define VL_EXPORT

See also
  Other compiler-specific features

#define VL_INLINE

See also
  Other compiler-specific features

#define VL_INT16_C | ( |  | x | ) | x

Parameters

  x | integer constant.

Returns
  x with the correct suffix for the given sign and size. The suffix used depends on the Data models.

Example:
  The macro `VL_INT64_C(1234)` is expanded as `123L` in a LP64 system and as `123LL` in a LLP64 system.

#define VL_INT32_C | ( |  | x | ) | x

Parameters

  x | integer constant.

Returns
  x with the correct suffix for the given sign and size. The suffix used depends on the Data models.

Example:
  The macro `VL_INT64_C(1234)` is expanded as `123L` in a LP64 system and as `123LL` in a LLP64 system.

#define VL_INT64_C | ( |  | x | ) | x ## L

Parameters

  x | integer constant.

Returns
  x with the correct suffix for the given sign and size. The suffix used depends on the Data models.

Example:
  The macro `VL_INT64_C(1234)` is expanded as `123L` in a LP64 system and as `123LL` in a LLP64 system.

#define VL_INT8_C | ( |  | x | ) | x

Parameters

  x | integer constant.

Returns
  x with the correct suffix for the given sign and size. The suffix used depends on the Data models.

Example:
  The macro `VL_INT64_C(1234)` is expanded as `123L` in a LP64 system and as `123LL` in a LLP64 system.

#define VL_STRINGIFY | ( |  | x | ) | # x

Parameters

  x | value to be stringified.

This macro stringifies the argument x by means of the `#` prerpocessor operator.

The standard C preprocessor does not prescan arguments which are stringified, so

#define A B
char const * str = VL_STRINGIFY(A) ;

initializes `str` with a pointer to the string `"A"`, which mihgt be unexpected. To fix this issue, you can use VL_XSTRINGIFY.

See also
  VL_XSTRINGIFY

#define VL_THREADS_POSIX 1

See also
  Multi-threading

#define VL_THREADS_WIN 1

See also
  Multi-threading

#define VL_UINT16_C | ( |  | x | ) | x

Parameters

  x | integer constant.

Returns
  x with the correct suffix for the given sign and size. The suffix used depends on the Data models.

Example:
  The macro `VL_INT64_C(1234)` is expanded as `123L` in a LP64 system and as `123LL` in a LLP64 system.

#define VL_UINT32_C | ( |  | x | ) | x ## U

Parameters

  x | integer constant.

Returns
  x with the correct suffix for the given sign and size. The suffix used depends on the Data models.

Example:
  The macro `VL_INT64_C(1234)` is expanded as `123L` in a LP64 system and as `123LL` in a LLP64 system.

#define VL_UINT64_C | ( |  | x | ) | x ## UL

Parameters

  x | integer constant.

Returns
  x with the correct suffix for the given sign and size. The suffix used depends on the Data models.

Example:
  The macro `VL_INT64_C(1234)` is expanded as `123L` in a LP64 system and as `123LL` in a LLP64 system.

#define VL_UINT8_C | ( |  | x | ) | x

Parameters

  x | integer constant.

Returns
  x with the correct suffix for the given sign and size. The suffix used depends on the Data models.

Example:
  The macro `VL_INT64_C(1234)` is expanded as `123L` in a LP64 system and as `123LL` in a LLP64 system.

#define VL_XCAT | ( |  | x,
|  |  | y
| ) |  | VL_CAT(x,y)

Parameters

  x | first argument to be concatenated.
  y | second argument to be concatenated.

This macro is the same as VL_CAT, except that the arguments are macro expanded before being concatenated.

See also
  VL_CAT

#define VL_XCAT3 | ( |  | x,
|  |  | y,
|  |  | z
| ) |  | VL_XCAT(VL_XCAT(x,y),z)

Parameters

  x | first argument to be concatenated.
  y | second argument to be concatenated.
  z | third argument to be concatenated.

This macro is the same as VL_XCAT, except that it has three arguments.

See also
  VL_XCAT

#define VL_XCAT4 | ( |  | x,
|  |  | y,
|  |  | z,
|  |  | u
| ) |  | VL_XCAT(VL_XCAT3(x,y,z),u)

Parameters

  x | first argument to be concatenated.
  y | second argument to be concatenated.
  z | third argument to be concatenated.
  u | fourth argument to be concatenated.

This macro is the same as VL_XCAT, except that it has four arguments.

See also
  VL_XCAT

#define VL_XCAT5 | ( |  | x,
|  |  | y,
|  |  | z,
|  |  | u,
|  |  | v
| ) |  | VL_XCAT(VL_XCAT4(x,y,z,u),v)

Parameters

  x | first argument to be concatenated.
  y | second argument to be concatenated.
  z | third argument to be concatenated.
  u | fourth argument to be concatenated.
  v | fifth argument to be concatenated.

This macro is the same as VL_XCAT, except that it has five arguments.

See also
  VL_XCAT

#define VL_XSTRINGIFY | ( |  | x | ) | VL_STRINGIFY(x)

Parameters

  x | value to be macro-expanded and converted.

This macro macro-expands the argument x and stringifies the result of the expansion. For instance

#define A B
char const * str = VL_STRINGIFY(A) ;

initializes `str` with a pointer to the string `"B"`.

See also
  VL_STRINGIFY

#define VL_YESNO | ( |  | x | ) | ((x)?"yes":"no")

Parameters

  x | boolean to convert.

A pointer to either the string "yes" (if x is true) or the string "no".

Example
  VL_PRINTF("Is x true? %s.", VL_YESNO(x))

## Function Documentation

char* vl_static_configuration_to_string_copy | ( |  | ) |

Returns
  a new string with the static configuration.

The string includes information about the compiler, the host, and other static configuration parameters. The string must be released by vl_free.

void vl_swap_host_big_endianness_2 | ( | void * | dst,
|  | void * | src
| ) |  |

inline

Parameters

  dst | destination 2-byte buffer.
  src | source 2-byte bufffer.

See also
  Endianness.

void vl_swap_host_big_endianness_4 | ( | void * | dst,
|  | void * | src
| ) |  |

inline

Parameters

  dst | destination 4-byte buffer.
  src | source 4-byte bufffer.

See also
  Endianness.

void vl_swap_host_big_endianness_8 | ( | void * | dst,
|  | void * | src
| ) |  |

inline

Parameters

  dst | destination 8-byte buffer.
  src | source 8-byte bufffer.

See also
  Endianness.