你把它们放到类作为类的成员Function就OK了

解决方案 »

  1.   

    这段代码我是稍微修改了的,原始的C代码如下:
    static unsigned char 
    decrypt_byte(const unsigned long *key) {
    unsigned short temp;

    temp = key[2] | 2;
    return((temp *( temp^1)) >> 8);
    }static unsigned long 
    Crc32 (unsigned long oldcrc, gchar newchar)
    {
    register unsigned long Crc = oldcrc;

            Crc = ((Crc >> 8) & 0x00ffffffL) ^ 
    crc_table[(Crc ^ newchar) & 0xffL];

    return Crc;            /* return a 1's complement */
    }
      

  2.   

    你修改一下数据类型吧。
    unsigned, gchar,在java中都不支持的。
    结构应该没有什么问题吧。
      

  3.   

    編譯提示兩個錯誤,一個是crc_table未定義,還有就是long to int會丟失精度
    先定義crc_table
    static long[] crc_table;
    再修改這一句:
    crc_table[(Crc ^ newchar) & 0xffL];

    crc_table[(int)(Crc^newchar) & 0xffL)];
      

  4.   

    对不起,搞忘说明了:crc_table是一个long型的数组;-)按 aiur(AIUR) 的方法试试先