第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

比較.NET中的兩個字節(jié)數(shù)組

比較.NET中的兩個字節(jié)數(shù)組

慕婉清6462132 2019-07-23 16:23:17
比較.NET中的兩個字節(jié)數(shù)組我怎么能快速做到這一點?當(dāng)然,我可以這樣做:static bool ByteArrayCompare(byte[] a1, byte[] a2){     if (a1.Length != a2.Length)         return false;     for (int i=0; i<a1.Length; i++)         if (a1[i]!=a2[i])             return false;     return true;}但我正在尋找BCL功能或一些經(jīng)過高度優(yōu)化的可靠方法來實現(xiàn)這一目標(biāo)。java.util.Arrays.equals((sbyte[])(Array)a1, (sbyte[])(Array)a2);很好地工作,但它看起來不適用于x64。請注意我的超快速的答案在這里。
查看完整描述

3 回答

?
翻翻過去那場雪

TA貢獻(xiàn)2065條經(jīng)驗 獲得超14個贊

P / Invoke功能激活!

[DllImport("msvcrt.dll", CallingConvention=CallingConvention.Cdecl)]static extern int memcmp(byte[] b1, byte[] b2, long count);static bool ByteArrayCompare(byte[] b1, byte[] b2){
    // Validate buffers are the same length.
    // This also ensures that the count does not exceed the length of either buffer.  
    return b1.Length == b2.Length && memcmp(b1, b2, b1.Length) == 0;}


查看完整回答
反對 回復(fù) 2019-07-23
  • 3 回答
  • 0 關(guān)注
  • 694 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號