Fix for Nim devel discrimination checks.

This commit is contained in:
cheatfate 2019-06-03 10:24:51 +03:00
parent 738a9e7b72
commit 38dd4cb6e7
No known key found for this signature in database
GPG Key ID: 46ADD633A7201F95

View File

@ -98,10 +98,10 @@ proc init*(t: typedesc[IpMask], family: AddressFamily, prefix: int): IpMask =
proc init*(t: typedesc[IpMask], netmask: TransportAddress): IpMask =
## Initialize network mask using address ``netmask``.
if netmask.family == AddressFamily.IPv4:
result.family = netmask.family
result = IpMask(family: netmask.family)
result.mask4 = cast[ptr uint32](unsafeAddr netmask.address_v4[0])[]
elif netmask.family == AddressFamily.IPv6:
result.family = netmask.family
result = IpMask(family: netmask.family)
result.mask6[0] = cast[ptr uint64](unsafeAddr netmask.address_v6[0])[]
result.mask6[1] = cast[ptr uint64](unsafeAddr netmask.address_v6[8])[]