Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ember.js/4.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 为什么我们在用于记忆测试的模式的末尾发现了ULL?_C_Memory Management_Constants_Error Checking - Fatal编程技术网

C 为什么我们在用于记忆测试的模式的末尾发现了ULL?

C 为什么我们在用于记忆测试的模式的末尾发现了ULL?,c,memory-management,constants,error-checking,C,Memory Management,Constants,Error Checking,在为测试内存而编写的模式末尾添加ULL的效用是什么 例如 uint64 pattern_55 = 0xAAAAAAAAAAAAAAAAULL; static error_t sram_aa_55_test(uint32 start_address, uint32 tested_area_size) { error_t status = E_NOERROR; /*Patterns used to test every SRAM cell */ uin

在为测试内存而编写的模式末尾添加ULL的效用是什么

例如

uint64 pattern_55 =  0xAAAAAAAAAAAAAAAAULL;

static error_t  sram_aa_55_test(uint32 start_address, uint32 tested_area_size)
  {
    error_t status = E_NOERROR;

          /*Patterns used to test every SRAM cell */
    uint64 pattern_aa = 0x5555555555555555ULL;
    uint64 pattern_55 = 0xAAAAAAAAAAAAAAAAULL;

          /* Current address being tested */
    uint32 address;

          /* data read back in memory */
    uint64 data_read;

          /* AA pattern test */
    memset((uint64*)start_address, pattern_aa, tested_area_size);
    sync();

    for (address = start_address; address < start_address + tested_area_size; address += sizeof(uint64))
    {
            /* read back the memory cell and check that it contains the same pattern we just wrote */
      data_read = rd_io_64(address);

      if (data_read != pattern_aa)
      {
        return CORE_Test_Error;
      }
    }
  }
uint64模式_55=0xaaaaaaaaaaaaaaaall;
静态错误sram aa 55测试(uint32起始地址、uint32测试区域大小)
{
错误状态=无错误;
/*用于测试每个SRAM单元的模式*/
uint64模式_aa=0x5555555555Ull;
uint64模式_55=0xAAAAAAAAAAAAAAAAAAULL;
/*正在测试的当前地址*/
uint32地址;
/*在存储器中读回的数据*/
uint64数据读取;
/*AA模式测试*/
memset((uint64*)起始地址、模式aa、测试区域大小);
sync();
用于(地址=起始地址;地址<起始地址+测试区域大小;地址+=大小(uint64))
{
/*读回内存单元并检查它是否包含与我们刚才编写的相同的模式*/
数据读取=rd io 64(地址);
if(数据读取!=模式读取)
{
返回核心测试错误;
}
}
}

它是一个后缀,表示整型文字是无符号长文字。

它是一个后缀,表示整型文字是无符号长文字。

对于代码片段,它仅用于对代码进行自我注释

suffux
llu
用于显式指定整型常量的类型为
无符号long

但是,当常量以十六进制表示法表示时,可以省略后缀,因为编译器本身确定常量的类型。即(C标准,6.4.4.1整数常量)

5整型常量的类型是对应的 可以表示其值的列表

对于十六进制整数常量

int
unsigned int
long int
unsigned long int
long long int
unsigned long long int

对于您的代码片段,它仅用于对代码进行自我注释

suffux
llu
用于显式指定整型常量的类型为
无符号long

但是,当常量以十六进制表示法表示时,可以省略后缀,因为编译器本身确定常量的类型。即(C标准,6.4.4.1整数常量)

5整型常量的类型是对应的 可以表示其值的列表

对于十六进制整数常量

int
unsigned int
long int
unsigned long int
long long int
unsigned long long int

这是整数的后缀,将其标记为
无符号long-long
。请花一些时间阅读您的书籍、教程或课堂笔记,看看它们是否提到。如果有(这里可能没有给出非标准typedef),
UINT64_C()
可能应该使用,而不是直接使用类型整数后缀。这确保使用正确的大小,因为不同平台的类型大小可能不同。@ThomasJager ULL就足够了。实际上,在此上下文中不需要后缀。这是整数的后缀,将其标记为
无符号long
。请花一些时间阅读您的书籍、教程或课堂笔记,看看它们是否提到。如果有(这里可能没有给出非标准typedef),
UINT64_C()
可能应该使用,而不是直接使用类型整数后缀。这确保使用正确的大小,因为不同平台的类型大小可能不同。@ThomasJager ULL就足够了。实际上,在这个上下文中不需要后缀。@christiangibons这并不重要。任何一条记录都可以用作例如llu、ull、ull、llu、llu、ull、llu、ull。@christiangibons这并不重要。任一记录都可以用作例如llu、ull、ull、llu、llu、ull、llu、ull。