styleCheck: make the compiler and large parts of the stdlib compatible with --styleCheck:error
This commit is contained in:
parent
96523cdd3e
commit
c94647aeca
90 changed files with 680 additions and 652 deletions
|
|
@ -13,33 +13,33 @@
|
|||
when defined(gcc) or defined(llvm_gcc) or defined(clang):
|
||||
const useBuiltinSwap = true
|
||||
proc builtin_bswap16(a: uint16): uint16 {.
|
||||
importc: "__builtin_bswap16", nodecl, nosideeffect.}
|
||||
importc: "__builtin_bswap16", nodecl, noSideEffect.}
|
||||
|
||||
proc builtin_bswap32(a: uint32): uint32 {.
|
||||
importc: "__builtin_bswap32", nodecl, nosideeffect.}
|
||||
importc: "__builtin_bswap32", nodecl, noSideEffect.}
|
||||
|
||||
proc builtin_bswap64(a: uint64): uint64 {.
|
||||
importc: "__builtin_bswap64", nodecl, nosideeffect.}
|
||||
importc: "__builtin_bswap64", nodecl, noSideEffect.}
|
||||
elif defined(icc):
|
||||
const useBuiltinSwap = true
|
||||
proc builtin_bswap16(a: uint16): uint16 {.
|
||||
importc: "_bswap16", nodecl, nosideeffect.}
|
||||
importc: "_bswap16", nodecl, noSideEffect.}
|
||||
|
||||
proc builtin_bswap32(a: uint32): uint32 {.
|
||||
importc: "_bswap", nodecl, nosideeffect.}
|
||||
importc: "_bswap", nodecl, noSideEffect.}
|
||||
|
||||
proc builtin_bswap64(a: uint64): uint64 {.
|
||||
importc: "_bswap64", nodecl, nosideeffect.}
|
||||
importc: "_bswap64", nodecl, noSideEffect.}
|
||||
elif defined(vcc):
|
||||
const useBuiltinSwap = true
|
||||
proc builtin_bswap16(a: uint16): uint16 {.
|
||||
importc: "_byteswap_ushort", nodecl, header: "<intrin.h>", nosideeffect.}
|
||||
importc: "_byteswap_ushort", nodecl, header: "<intrin.h>", noSideEffect.}
|
||||
|
||||
proc builtin_bswap32(a: uint32): uint32 {.
|
||||
importc: "_byteswap_ulong", nodecl, header: "<intrin.h>", nosideeffect.}
|
||||
importc: "_byteswap_ulong", nodecl, header: "<intrin.h>", noSideEffect.}
|
||||
|
||||
proc builtin_bswap64(a: uint64): uint64 {.
|
||||
importc: "_byteswap_uint64", nodecl, header: "<intrin.h>", nosideeffect.}
|
||||
importc: "_byteswap_uint64", nodecl, header: "<intrin.h>", noSideEffect.}
|
||||
else:
|
||||
const useBuiltinSwap = false
|
||||
|
||||
|
|
@ -49,17 +49,17 @@ when useBuiltinSwap:
|
|||
## may point to a unaligned address. A sufficiently smart compiler _should_
|
||||
## be able to elide them when they're not necessary.
|
||||
var tmp: T
|
||||
copyMem(addr tmp, inp, sizeOf(T))
|
||||
copyMem(addr tmp, inp, sizeof(T))
|
||||
tmp = op(tmp)
|
||||
copyMem(outp, addr tmp, sizeOf(T))
|
||||
copyMem(outp, addr tmp, sizeof(T))
|
||||
|
||||
proc swapEndian64*(outp, inp: pointer) {.inline, nosideeffect.}=
|
||||
proc swapEndian64*(outp, inp: pointer) {.inline, noSideEffect.}=
|
||||
swapOpImpl(uint64, builtin_bswap64)
|
||||
|
||||
proc swapEndian32*(outp, inp: pointer) {.inline, nosideeffect.}=
|
||||
proc swapEndian32*(outp, inp: pointer) {.inline, noSideEffect.}=
|
||||
swapOpImpl(uint32, builtin_bswap32)
|
||||
|
||||
proc swapEndian16*(outp, inp: pointer) {.inline, nosideeffect.}=
|
||||
proc swapEndian16*(outp, inp: pointer) {.inline, noSideEffect.}=
|
||||
swapOpImpl(uint16, builtin_bswap16)
|
||||
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue