X
xmwgp
Unregistered / Unconfirmed
GUEST, unregistred user!
如题。<br>现在有个C的函数如下,对C不熟悉,麻烦哪位大富翁帮忙翻译到DELPHI,谢谢。<br><br>或者直接帮忙写一个相同功能的DELPHI函数。<br><br> /// <summary><br> ///将整型转化为字节数组<br> /// </summary><br> /// <param name="num">要转化的整型</param><br> /// <param name="len">转化后字节数组长度</param><br> /// <returns></returns><br> public byte[] intToBytes(int num, int len)<br> {<br> byte[] b = new byte[len];<br> int sw = ((len - 1) * 8);<br> int mask = (0xff << sw);<br> for (int l = 0; l < len; l++)<br> {<br> b[l] = (byte)(((uint)num & mask) >> sw);<br> sw -= 8;<br> mask >>= 8;<br> }<br> return b;<br> }