ROTATE(3clc)

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

πŸ’« 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 πŸ‘€


🫢 AUTHORS 🫢

The Khronos Group β€” icons only πŸ‘‘


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 πŸ”₯

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