我有一个应用程序,它使用一个数据库,其中的数据以大端顺序存储。为了跨硬件平台可移植地访问此数据,我使用了config.h模块中定义的4个宏: word(p) - gets a big-endian 16 bit value at pointer p as a native 16-bit value.
putword(p, w) - stores a native 16-bit variable (w) to pointer p as 16-bit big-endian.
dword(p) and putdword(p, d) do the same for 32-bit values 这一切
当WIN32文档中这样写道:
wParam
The low-order word specifies the edit control identifier.
The high-order word specifies the notification message.
构建wParam的好方法是什么?
我目前正在使用BitConverter在一个有符号的整型中打包两个无符号的短裤。这段代码对不同的值执行了数百万次,我认为代码可以进一步优化。这就是我目前正在做的事情--你可以假设代码是C#/NET。
// to two unsigned shorts from one signed int:
int xy = 343423;
byte[] bytes = BitConverter.GetBytes(xy);
ushort m_X = BitConverter.ToUInt16(bytes, 0);
ushort m_Y = BitConverter.ToUInt16(bytes, 2);
/
我是C#的新手,我看过以前类似问题的答案,但仍然卡住了。我需要收集和处理3个包含ushort数组的结构数组。我创建了一个类来保存我的结构:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
struct Wvsamps
{
ushort[] wav1 = new ushort[3];
ushort[] wav2 = new ushort[3];
ushort[] wav3 = new ushort[3];
ushort[] wav4 = n
我想在C#中导入一个用C语言编写的动态链接库。下面是我要调用的函数的格式。
/*
*ReadAnswer
*@param objectID The answer object ID
*@param answerBuf The answer buffer.This buffer is automatically allocated by
the function.
It is automatically recycled with each call. A cal