111,119
社区成员
发帖
与我相关
我的任务
分享
unsafe struct Block2
{
[MarshalAs(UnmanagedType.ByValArray,SizeConst=8)]
public byte[] a;
public ushort index1;
public ushort index2;
public uint flag;
}
struct Block
{
public Block()
{
a1=a2=.a3.. =a8=0;
Indices1 = 0;
Indices2 = 0;
bitmask = 0;
}
byte a1,a2,a3...a8;
unit16 index1;
unit16 index2;
uint32 flag;
unsafe struct Block
{
[StructLayout(LayoutKind.Sequential, Size = 8)]
public struct aAtruct
{
public byte this[int index]
{
get
{
fixed (aAtruct* aptr = &this)
{
byte* ptr = (byte*)aptr;
return ptr[index];
}
}
}
}
public aAtruct a;
public ushort index1;
public ushort index2;
public uint flag;
}
unsafe struct Block2
{
[MarshalAs(UnmanagedType.ByValArray)]
public byte[] a;
public ushort index1;
public ushort index2;
public uint flag;
}
struct Block
{
public Block(int i) //i?
{
a = new byte[8];
Indices1 = 0;
Indices2 = 0;
bitmask = 0; //bitmask?=>flag?!
}
byte[] a;
uint16 index1;
uint16 index2;
uint flag;
};