Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

Vector Data Types

For the scalar integer and floating-point data types described in Table 4.1, OpenCL C adds support for vector data types. The vector data type is defined with the type name, that is, char, uchar, short, ushort, int, uint, float, long, or ulong followed by a literal value n that defines the number of elements in the vector. Supported values of n are 2, 3, 4, 8, and 16 for all vector data types. Optionally, vector data types are also defined for double and half. These are available only if the device supports the double-precision and half-precision extensions. The supported vector data types are described in Table 4.2.

Table 4.2. Built-In Vector Data Types
TypeDescription
charnA vector of n 8-bit signed integer values
ucharnA vector of n 8-bit unsigned integer values
shortnA vector of n 16-bit signed integer values
ushortnA vector of n 16-bit unsigned integer values
intnA vector of n 32-bit signed integer values
uintnA vector of n 32-bit unsigned integer values
longnA vector of n 64-bit signed integer values
ulongnA vector of n 64-bit unsigned integer values
floatnA vector of n 32-bit floating-point values
doublenA vector of n 64-bit floating-point values
halfnA vector of n 16-bit floating-point values



  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial