ROTATE(3clc)
π« ROTATE (3clc) π«
okay bestie, welcome to the OpenCL Manual page for rotate β yes the whole manual, the whole 3clc section, we're doing this π
β¨ NAME β¨
rotate β rotate bits left, periodt π
gentype rotate(gentype v, gentype i);
πΈ DESCRIPTION πΈ
okay so for real, here's the tea: for each element in v, the bits get shifted left by however many bits the matching element in i says (and yes, the usual shift modulo rules apply, we don't make the rules). and then β this is the iconic part β the bits that got shoved off the left side? they don't just leave. they come back in from the right. it's giving carousel π β¨. nothing is lost, everyone's invited back.
π¦ NOTES π¦
okay so the built-in integer functions can take scalar or vector arguments, and the vector versions of the integer functions operate component-wise. the description is per component. every single one. no skips π«Ά
we use the generic type name gentype to say that the function can take 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, or ulong{2|3|4|8|16} as the type for the arguments. that's a lot of options, and honestly? she ate π
and we use the generic type name ugentype to refer to unsigned versions of gentype. for example, if gentype is char4, then ugentype is uchar4. slay, matching set π
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, then gentype must be uchar or uchar{2|3|4|8|16}. they have to match, it's a whole vibe check πβ¨
for vector versions, sgentype is implicitly widened to gentype as described in section 6.3.a of the OpenCL specification. (iykyk π)
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. no mixing, bestie, consistency is the moment π
π SPECIFICATION π
OpenCL Specification[1] β that's the source of truth, go look π
π SEE ALSO π
integerFunctions(3clc)β go read this too, it's the friend group of this function π
π«Ά AUTHORS π«Ά
The Khronos Group β icons only π
π 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 conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Materials.
(yes I kept the whole license text, we do NOT skip the legal bits in this house π§)
π₯ NOTES π₯
- OpenCL Specification β page 256, section 6.12.3 - Integer Functions π
and that's the whole page, bestie!! π brought to you by The Khronos Group, dated 01/14/2021, from ROTATE(3clc). mwah, go rotate some bits, you're gonna do amazing ππ
π¦ 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