bindata 2.4.9 → 2.4.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a511668b89503e38575dbc2eb0f02e542556c63bf008294a2a99a4f116639d74
4
- data.tar.gz: 259742f4fe4f2632b0edca7bf155277198291663546ff3c148d1d515ac8e76d5
3
+ metadata.gz: 651bb61168cb520dbec6550dc4ee3d566e950a0a4e3c373752a37d9ced6dc17e
4
+ data.tar.gz: 543f3849f0502255c976520e3d11f2e988f0733314b905d098b8617025ef2d99
5
5
  SHA512:
6
- metadata.gz: 1e2f3a1a41443ec3ddfc44734bd7c1e03d6c957ea86d86fa68f0ec913df63ac5c2a32e26ef73fe2d8abe889fdfe916d2e9fc97686ede3fd6e1e51598480acbb5
7
- data.tar.gz: e3f21a9882a1a259044cfd284308ba6d13d1bef9674b03c7a501fae53a30fac5b868a9d5a11bc10302889bd03d5e73e6e9203c1b5b395b9ba12a33ed9b4c7f72
6
+ metadata.gz: 5ab4ddc205727d64b5b4f1354c6c738965745ff6736030f440c3982799351e68af06c9f1e0faff28d6e52830a0abf55d678a0ea7ffefa160f9f7bf3c309b6e7b
7
+ data.tar.gz: 834bdfa27436e578043e8b92ded99a02e6fc5ca2d0e11f0503bf3d8d68c1c7c9e491e66fe59f264156fb9675437cc9f014193f42132a8e6aec3a11b6f84f5312
data/ChangeLog.rdoc CHANGED
@@ -1,5 +1,9 @@
1
1
  = BinData Changelog
2
2
 
3
+ == Version 2.4.10 (2021-05-18)
4
+
5
+ * Improve speed of dynamic object creation. Reported by Charlie Ablett.
6
+
3
7
  == Version 2.4.9 (2021-04-22)
4
8
 
5
9
  * Change example from Fixnum to Integer. Thanks to Tim Chambers.
data/lib/bindata/bits.rb CHANGED
@@ -115,14 +115,14 @@ module BinData
115
115
  end
116
116
 
117
117
  if signed == :signed
118
- max = (1 << (nbits - 1)) - 1
119
- min = -(max + 1)
118
+ max = "max = (1 << (#{nbits} - 1)) - 1"
119
+ min = "min = -(max + 1)"
120
120
  else
121
- min = 0
122
- max = (1 << nbits) - 1
121
+ min = "min = 0"
122
+ max = "max = (1 << #{nbits}) - 1"
123
123
  end
124
124
 
125
- clamp = "(val < #{min}) ? #{min} : (val > #{max}) ? #{max} : val"
125
+ clamp = "(#{max}; #{min}; val = (val < min) ? min : (val > max) ? max : val)"
126
126
 
127
127
  if nbits == 1
128
128
  # allow single bits to be used as booleans
data/lib/bindata/int.rb CHANGED
@@ -59,14 +59,16 @@ module BinData
59
59
 
60
60
  def create_clamp_code(nbits, signed)
61
61
  if signed == :signed
62
- max = (1 << (nbits - 1)) - 1
63
- min = -(max + 1)
62
+ max = "max = (1 << (#{nbits} - 1)) - 1"
63
+ min = "min = -(max + 1)"
64
64
  else
65
- max = (1 << nbits) - 1
66
- min = 0
65
+ max = "max = (1 << #{nbits}) - 1"
66
+ min = "min = 0"
67
67
  end
68
68
 
69
- "val = (val < #{min}) ? #{min} : (val > #{max}) ? #{max} : val"
69
+ clamp = "(#{max}; #{min}; val = (val < min) ? min : (val > max) ? max : val)"
70
+
71
+ "val = #{clamp}"
70
72
  end
71
73
 
72
74
  def create_read_code(nbits, endian, signed)
@@ -1,3 +1,3 @@
1
1
  module BinData
2
- VERSION = "2.4.9"
2
+ VERSION = "2.4.10"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bindata
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.9
4
+ version: 2.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dion Mendel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-21 00:00:00.000000000 Z
11
+ date: 2021-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake