小编kil*_*ler的帖子

通用 CRC (8/16/32/64) 结合实现

这个问题的旧标题: CRC16 combine implementation vs CRC32 combine Implementation之间的区别

我正在尝试实现类似于 CRC32 组合实现的 CRC16 组合实现。我使用的CRC-CCITT(初始值:0xFFFF的,保利:0x1021)描述在这里

我阅读并试图理解本答案中描述的 CRC32_Combine 实现,但我还没有完全理解它。我已经为 CRC16 组合做了一个 C# 实现,只是将 32x32 矩阵修改为 16x16,更多我不确定。我应该得到以下值,但我没有得到这些值:

Msg1 : "123" CRC-16-CCITT : 0x5bce
Msg2 : "456789" CRC-16-CCITT : 0x6887
Combined Msg1 + Msg2 : "123456789" CRC-16-CCITT should be "0x29B1".
But what I got with my code below is "0x64d8". 
Run Code Online (Sandbox Code Playgroud)

ZLib 的 C# 代码:

    const UInt16 poly16Reverse = 0x8408;
    const Int16 GF2_DIM = 16;

    private static UInt16 gf2_matrix_times(UInt16[] mat, UInt16 vec) …
Run Code Online (Sandbox Code Playgroud)

c# checksum crc crc16

3
推荐指数
1
解决办法
2479
查看次数

如何通过execvp()启动进程的进程ID

我是linux编程的新手,我想得到一些关于杀死一个开始使用的进程的建议execvp().以下是"TestApplication"作为子进程启动的代码.当用户中断(ctrl + C)时,我想"TestApplication"和父进程一起杀死它.

有关如何实现这一目标的任何建议.PLS.救命.谢谢.

int main(int argc, char* argv[])
{
   signal(SIGINT, KillProcess); 

   pid_t pid;
   pid = fork();
   if(pid == -1)
   {
      printf("Error: Fork process failed");
      exit(-1);
   }
   else if (pid == 0)
   {
      char *const paramList[] = {"5"," 1", NULL};
      execvp("TestApplication", paramList);
   }
   else
   {
      // Wait for signal from the TestApplication process when successfully executed
   }
   return 0;
}

void KillProcess(int sig)
{
    // Want to get the process ID of "TestApplication"
    // …
Run Code Online (Sandbox Code Playgroud)

c linux

1
推荐指数
1
解决办法
736
查看次数

标签 统计

c ×1

c# ×1

checksum ×1

crc ×1

crc16 ×1

linux ×1