Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 C++ 中有以下函数:
void put8At ( unsigned char *b, int pos, int v ) { union { short a; unsigned char b[2]; } u; u.a = v; b += pos; *b = v & 0xff; }
你将如何在 C# 中编写代码?
以下是我将如何在 C++ 中对其进行编码:
void put8At ( unsigned char *b, int pos, int v ) { b[pos] = v & 0xff; }
现在这可能更容易转换为 C#。