mirror of
https://github.com/status-im/nimPNG.git
synced 2025-01-28 21:34:47 +00:00
no more warning
This commit is contained in:
parent
84c1269d56
commit
f0d663fd4b
@ -30,7 +30,7 @@ import streams, endians, tables, hashes, math, nimz
|
|||||||
import private.buffer
|
import private.buffer
|
||||||
|
|
||||||
const
|
const
|
||||||
NIM_PNG_VERSION = "0.1.5"
|
NIM_PNG_VERSION = "0.1.7"
|
||||||
|
|
||||||
type
|
type
|
||||||
PNGChunkType = distinct int32
|
PNGChunkType = distinct int32
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[Package]
|
[Package]
|
||||||
name = "nimPNG"
|
name = "nimPNG"
|
||||||
version = "0.1.6"
|
version = "0.1.7"
|
||||||
author = "Andri Lim"
|
author = "Andri Lim"
|
||||||
description = "PNG encoder and decoder"
|
description = "PNG encoder and decoder"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
8
nimz.nim
8
nimz.nim
@ -250,7 +250,7 @@ proc init_coins(c: var Coins, num: int) =
|
|||||||
proc cleanup_coins(c: var Coins, num: int) =
|
proc cleanup_coins(c: var Coins, num: int) =
|
||||||
for i in 0..num-1: c[i].symbols = @[]
|
for i in 0..num-1: c[i].symbols = @[]
|
||||||
|
|
||||||
proc cmpx(a, b: Coin): int =
|
proc cmpx(a, b: Coin): int {.locks:0.} =
|
||||||
var wa = a.weight
|
var wa = a.weight
|
||||||
var wb = b.weight
|
var wb = b.weight
|
||||||
if wa > wb: result = 1
|
if wa > wb: result = 1
|
||||||
@ -265,7 +265,7 @@ proc append_symbol_coins(coins: Coins, start: int, frequencies: openarray[int],
|
|||||||
coins[j].symbols.add i
|
coins[j].symbols.add i
|
||||||
inc j
|
inc j
|
||||||
|
|
||||||
proc placePivot[T](a: var openArray[T], lo, hi: int): int =
|
proc placePivot[T](a: var openArray[T], lo, hi: int): int {.locks:0.} =
|
||||||
var pivot = lo #set pivot
|
var pivot = lo #set pivot
|
||||||
var switch_i = lo + 1
|
var switch_i = lo + 1
|
||||||
let x = lo+1
|
let x = lo+1
|
||||||
@ -278,14 +278,14 @@ proc placePivot[T](a: var openArray[T], lo, hi: int): int =
|
|||||||
inc switch_i #set location for i to switch with pivot
|
inc switch_i #set location for i to switch with pivot
|
||||||
result = pivot #return pivot location
|
result = pivot #return pivot location
|
||||||
|
|
||||||
proc quickSort[T](a: var openArray[T], lo, hi: int) =
|
proc quickSort[T](a: var openArray[T], lo, hi: int) {.locks:0.} =
|
||||||
if lo >= hi: return #stop condition
|
if lo >= hi: return #stop condition
|
||||||
#set pivot location
|
#set pivot location
|
||||||
var pivot = placePivot(a, lo, hi)
|
var pivot = placePivot(a, lo, hi)
|
||||||
quickSort(a, lo, pivot-1) #sort bottom half
|
quickSort(a, lo, pivot-1) #sort bottom half
|
||||||
quickSort(a, pivot+1, hi) #sort top half
|
quickSort(a, pivot+1, hi) #sort top half
|
||||||
|
|
||||||
proc quickSort[T](a: var openArray[T], length = -1) =
|
proc quickSort[T](a: var openArray[T], length = -1) {.locks:0.} =
|
||||||
var lo = 0
|
var lo = 0
|
||||||
var hi = if length < 0: a.high else: length-1
|
var hi = if length < 0: a.high else: length-1
|
||||||
quickSort(a, lo, hi)
|
quickSort(a, lo, hi)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user