SUB_SAT(3clc)

πŸ“¦
version 1.0~svn33624 Β· 3 versions
, in ubuntu jammy, ubuntu noble

πŸ’– 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 Β© 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 🫢)

  1. 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