小编Fab*_*eis的帖子

CRC16 ISO 13239实施

我正在尝试在C#中实现Crc16.我已经尝试过很多不同的实现,但是大多数都给了我不同的值.以下是我已经使用过的一些代码.

    private static int POLYNOMIAL = 0x8408;
    private static int PRESET_VALUE = 0xFFFF;

    public static int crc16(byte[] data)
    {
        int current_crc_value = PRESET_VALUE;
        for (int i = 0; i < data.Length; i++)
        {
            current_crc_value ^= data[i] & 0xFF;
            for (int j = 0; j < 8; j++)
            {
                if ((current_crc_value & 1) != 0)
                {
                    current_crc_value = (current_crc_value >> 1) ^ POLYNOMIAL;
                }
                else
                {
                    current_crc_value = current_crc_value >> 1;
                }
            }
        }
        current_crc_value = ~current_crc_value;

        return current_crc_value & 0xFFFF; …
Run Code Online (Sandbox Code Playgroud)

c# crc crc16

5
推荐指数
1
解决办法
2万
查看次数

如何在MonoDroid的代码隐藏中设置保证金?

这个问题很简单,但我对此一无所知.如何在代码隐藏中将边距设置为窗口小部件.

我在Xamarin的网站上找到了这个文档,但我无法将其用于ImageView

我也在我的ImageView中尝试过Layout()方法,但它没有用.

        ImageView imgView = FindViewById<ImageView>(Resource.Id.imageView);
        imgView.Layout(10, 10, 10, 10);
Run Code Online (Sandbox Code Playgroud)

c# android android-layout xamarin.android xamarin

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

标签 统计

c# ×2

android ×1

android-layout ×1

crc ×1

crc16 ×1

xamarin ×1

xamarin.android ×1