mirror of
https://github.com/netfun2000/ip2region.git
synced 2026-02-27 09:44:31 +08:00
feat:support for concurrent file-based queries
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Net;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace IP2Region.Net.XDB;
|
||||
|
||||
@@ -14,12 +15,9 @@ public static class Util
|
||||
{
|
||||
byte[] bytes = ipAddress.GetAddressBytes();
|
||||
Array.Reverse(bytes);
|
||||
return BitConverter.ToUInt32(bytes, 0);
|
||||
return MemoryMarshal.Read<uint>(bytes);
|
||||
}
|
||||
|
||||
public static uint GetMidIp(uint x, uint y)
|
||||
=> (x & y) + ((x ^ y) >> 1);
|
||||
|
||||
public static int GetMidIp(int x, int y)
|
||||
=> (x & y) + ((x ^ y) >> 1);
|
||||
}
|
||||
Reference in New Issue
Block a user