Restrict pragma: use C, C++, VCC + GCC + LLVM compatible syntax (#41)

This commit is contained in:
Mamy Ratsimbazafy 2018-05-08 11:46:21 +02:00 committed by GitHub
parent 1b7423eacd
commit 1653a8815f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View File

@ -262,7 +262,7 @@ func dumpHex*(x: Stint or StUint, order: static[Endianness]): string =
hexChars = "0123456789abcdef"
size = getSize(x.data) div 8
{.pragma: restrict, codegenDecl: "$# __restrict__ $#".}
{.pragma: restrict, codegenDecl: "$# __restrict $#".}
let bytes {.restrict.}= cast[ptr array[size, byte]](x.unsafeaddr)
result = newString(2*size)

View File

@ -133,7 +133,7 @@ macro asSignedWordsZip*[T](
# if we have multiple iterations to do
if system.cpuEndian == bigEndian:
result = quote do:
{.pragma: restrict, codegenDecl: "$# __restrict__ $#".}
{.pragma: restrict, codegenDecl: "$# __restrict $#".}
let
`next_x`{.restrict.} = cast[ptr `optim_type`](`x`.unsafeaddr)
`next_y`{.restrict.} = cast[ptr `optim_type`](`y`.unsafeaddr)
@ -143,7 +143,7 @@ macro asSignedWordsZip*[T](
else:
# Little-Endian, iteration in reverse
result = quote do:
{.pragma: restrict, codegenDecl: "$# __restrict__ $#".}
{.pragma: restrict, codegenDecl: "$# __restrict $#".}
let
`next_x`{.restrict.} = cast[ptr `optim_type`](`x`.unsafeaddr)
`next_y`{.restrict.} = cast[ptr `optim_type`](`y`.unsafeaddr)

View File

@ -159,7 +159,7 @@ macro asWordsZip*(x, y: UintImpl or IntImpl, ignoreEndianness: static[bool], loo
else:
if ignoreEndianness or system.cpuEndian == bigEndian:
result = quote do:
{.pragma: restrict, codegenDecl: "$# __restrict__ $#".}
{.pragma: restrict, codegenDecl: "$# __restrict $#".}
let
`inner_x`{.restrict.} = cast[ptr `optim_type`](`x`.unsafeaddr)
`inner_y`{.restrict.} = cast[ptr `optim_type`](`y`.unsafeaddr)
@ -168,7 +168,7 @@ macro asWordsZip*(x, y: UintImpl or IntImpl, ignoreEndianness: static[bool], loo
else:
# Little-Endian, iteration in reverse
result = quote do:
{.pragma: restrict, codegenDecl: "$# __restrict__ $#".}
{.pragma: restrict, codegenDecl: "$# __restrict $#".}
let
`inner_x`{.restrict.} = cast[ptr `optim_type`](`x`.unsafeaddr)
`inner_y`{.restrict.} = cast[ptr `optim_type`](`y`.unsafeaddr)
@ -224,7 +224,7 @@ macro m_asWordsZip*[T: UintImpl or IntImpl](m: var T, x: T,
else:
if ignoreEndianness or system.cpuEndian == bigEndian:
result = quote do:
{.pragma: restrict, codegenDecl: "$# __restrict__ $#".}
{.pragma: restrict, codegenDecl: "$# __restrict $#".}
let
`inner_m`{.restrict.} = cast[ptr `optim_type`](`m`.addr)
`inner_x`{.restrict.} = cast[ptr `optim_type`](`x`.unsafeaddr)
@ -233,7 +233,7 @@ macro m_asWordsZip*[T: UintImpl or IntImpl](m: var T, x: T,
else:
# Little-Endian, iteration in reverse
result = quote do:
{.pragma: restrict, codegenDecl: "$# __restrict__ $#".}
{.pragma: restrict, codegenDecl: "$# __restrict $#".}
let
`inner_m`{.restrict.} = cast[ptr `optim_type`](`m`.addr)
`inner_x`{.restrict.} = cast[ptr `optim_type`](`x`.unsafeaddr)
@ -298,7 +298,7 @@ macro m_asWordsZip*[T: UintImpl or IntImpl](m: var T, x, y: T,
else:
if ignoreEndianness or system.cpuEndian == bigEndian:
result = quote do:
{.pragma: restrict, codegenDecl: "$# __restrict__ $#".}
{.pragma: restrict, codegenDecl: "$# __restrict $#".}
let
`inner_m`{.restrict.} = cast[ptr `optim_type`](`m`.addr)
`inner_x`{.restrict.} = cast[ptr `optim_type`](`x`.unsafeaddr)
@ -308,7 +308,7 @@ macro m_asWordsZip*[T: UintImpl or IntImpl](m: var T, x, y: T,
else:
# Little-Endian, iteration in reverse
result = quote do:
{.pragma: restrict, codegenDecl: "$# __restrict__ $#".}
{.pragma: restrict, codegenDecl: "$# __restrict $#".}
let
`inner_m`{.restrict.} = cast[ptr `optim_type`](`m`.addr)
`inner_x`{.restrict.} = cast[ptr `optim_type`](`x`.unsafeaddr)