Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/140.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ “的名称查找”__旋转4“;没有找到声明_C++_Aix_Intrinsics_Xlc - Fatal编程技术网

C++ “的名称查找”__旋转4“;没有找到声明

C++ “的名称查找”__旋转4“;没有找到声明,c++,aix,intrinsics,xlc,C++,Aix,Intrinsics,Xlc,我正在编译场中处理GCC111。机器是AIX7.1、POWER7和IBMXLC12.1。我正在尝试使用\uu rotatel4: $ cat test.cxx #include <cstdlib> unsigned int Foo (unsigned int x) { return __rotatel4(x, 4U); } 根据编译器手册(第486页),内部函数应该是可用的。这是原型,它没有POWER6这样的限制: unsigned int __rotatel4 (unsig

我正在编译场中处理GCC111。机器是AIX7.1、POWER7和IBMXLC12.1。我正在尝试使用
\uu rotatel4

$ cat test.cxx
#include <cstdlib>

unsigned int Foo (unsigned int x)
{
  return __rotatel4(x, 4U);
}
根据编译器手册(第486页),内部函数应该是可用的。这是原型,它没有POWER6这样的限制:

unsigned int __rotatel4 (unsigned int rs, unsigned int shift)
添加
-qarch=pwr7
和/或
-D_XOPEN_SOURCE=600
会导致相同的错误。我发现了,但它似乎不适用于这里

如何在程序中使用
\uuu rotatel4



对于XL C/C++V12.1,您需要包括

$cat aaa.cpp
#包括
无符号整数Foo(无符号整数x)
{
返回旋转4(x,4U);
}
$xlC aaa.cpp-c
“aaa.cpp”,第5.10行:1540-0274(S)“_rotatel4”的名称查找未找到声明。
$cat aaa.cpp
#包括
#包括
无符号整数Foo(无符号整数x)
{
返回旋转4(x,4U);
}
$xlC aaa.cpp-c
$

对于即将发布的16.1版本,这是测试版,您不需要它。(有和没有都可以。)

再次感谢@Rafik。
\u rotatel4
到底做什么?描述中说了“向左旋转单词”,但没有说更多。我认为这是一个习惯的C循环的固有特性,但从失败的自检数量来看,它做了一些其他的事情。它将第一个参数旋转第二个参数指定的参数数量。下面是一个示例:
#include#include int main(){unsigned int a,b,c;a=0xabcdef01;for(int i=0;i<8;++i){b=u rotatel4(a,4*i);printf(“0x%08x\n,b)}返回0;}
打印:
0xabcdef01 0xbcdef01ab 0xdef01abc 0xef01abc 0xef01abc 0xef01abc 0xef01abc 0xef01abc 0xf01abc 0xf01abdef01abc 0x1abc 0x1abcdef0
unsigned int __rotatel4 (unsigned int rs, unsigned int shift)
gcc111$ oslevel -s
7100-03-02-1412

gcc111$ xlC -qversion
IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72)
Version: 12.01.0000.0000
$ cat aaa.cpp
#include <cstdlib>

unsigned int Foo (unsigned int x)
{
  return __rotatel4(x, 4U);
}
$ xlC aaa.cpp -c
"aaa.cpp", line 5.10: 1540-0274 (S) The name lookup for "__rotatel4" did not find a declaration.
$ cat aaa.cpp
#include <cstdlib>
#include <builtins.h>

unsigned int Foo (unsigned int x)
{
  return __rotatel4(x, 4U);
}
$ xlC aaa.cpp -c
$