SUB_SAT(3clc)
π NAME π
sub_sat β okay so picture this: it hands you x - y, and then it saturates the result. That's the whole job. That's the whole girl. π
This page lives in the OpenCL Manual, and it's page SUB_SAT(3clc) if you're out here collecting them like PokΓ©mon. π
gentype sub_sat(gentype x, gentype y);
β¨ DESCRIPTION β¨
sub_sat returns x - y and saturates the result. Periodt. No cap, that is literally the entire description. π¦
π NOTES π
Bestie, listen. Built-in integer functions take scalar or vector arguments. The vector versions of the integer functions operate component-wise, and the description is per component. So every component is out here living its own little life. π
We use the generic type name gentype to indicate that the function can take any of these as the type for the arguments:
char,char{2|3|4|8|16}uchar,uchar{2|3|4|8|16}short,short{2|3|4|8|16}ushort,ushort{2|3|4|8|16}int,int{2|3|4|8|16}uint,uint{2|3|4|8|16}long,long{2|3|4|8|16}ulong,ulong{2|3|4|8|16}
We use the generic type name ugentype to refer to unsigned versions of gentype. For example, if gentype is char4, ugentype is uchar4. π
We also use the generic type name sgentype to indicate that the function can take a scalar data type β i.e. char, uchar, short, ushort, int, uint, long, or ulong β as the type for the arguments. For built-in integer functions that take gentype and sgentype arguments, the gentype argument must be a vector or scalar version of the sgentype argument. For example, if sgentype is uchar, gentype must be uchar or uchar{2|3|4|8|16}. For vector versions, sgentype is implicitly widened to gentype as described in section 6.3.a of the OpenCL specification. π§
And for any specific use of a function, the actual type has to be the same for all arguments and the return type unless otherwise specified. Consistency is the vibe check here, fr fr. π
π SPECIFICATION π
OpenCL Specification[1]
π SEE ALSO π
integerFunctions(3clc) β go read that one next, it's iconic. πΈ
βοΈ AUTHORS βοΈ
The Khronos Group
Β©οΈ COPYRIGHT Β©οΈ
Copyright Β© 2007-2011 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the following condition: the above copyright notice and this permission notice shall be included in all copies or substantial portions of the Materials.
π NOTES π
(the footnote section, not to be confused with the other NOTES section, we contain multitudes π«Ά)
- OpenCL Specification page 256, section 6.12.3 - Integer Functions
And that's a wrap, bestie! This lil masterpiece was brought to you by The Khronos Group, dated 01/14/2021, straight out of the OpenCL Manual as SUB_SAT(3clc). Go forth and saturate responsibly. π¦πβ¨
π¦ where this page comes from
- ubuntu jammy: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- ubuntu noble: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms