libbin 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libbin/pghalf.c +28 -28
  3. data/libbin.gemspec +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a839d4dfb7966a79a1319812d1228919978b7ad98bffa0d99f8375b6d1756318
4
- data.tar.gz: dddf34d95677e7eec57f42dab96d278d0af6672d59a44126afa7ace584edbb14
3
+ metadata.gz: 2fdf975677061cebffe202e1d86030fd8c84d32f28c90c6907abd964d854e0cf
4
+ data.tar.gz: e54ea09722e208c8eb1368a73dbb9aa452e324e2b18dc59b007a826cb23c680a
5
5
  SHA512:
6
- metadata.gz: 4aa40ec6641631c60fbc11231a40519a42519f854496f74994a46f95e858e3d49bedf2c95cd88a317d9efd5174c16417562ba05533d2f90f4006fd6c52050663
7
- data.tar.gz: 9cdea5cac5feb7f7a5816bbc0670fefc77adb3f8febe9a3b2be7f8c85b95cd51426a8d668688a5b46c9dc45eb7b1d61f2fd6b23ca9fb20df0d5ceaab9126ac66
6
+ metadata.gz: 8490ee9cdec4a7268aeb19d2cd6bd37fa5af61930f1a3b3c1134e10768c211c2c67030054eb00bbd4c85ff6beff7c8b290ff4927ba86b45312168e49894695a3
7
+ data.tar.gz: 95a9b0b79b0bca2f9c7f8eef6154788ce2838ac436b23f958b67af3485bee706dfee7f3720a6bb29e88746a4ba04967479347f9fde9250160ad9a0f57a0b0a61
@@ -339,22 +339,22 @@ uint16_t
339
339
  pghalf_from_float( uint32_t f )
340
340
  {
341
341
  const uint32_t one = _uint32_li( 0x00000001 );
342
- const uint32_t f_s_mask = _uint32_li( 0x80000000 );
343
- const uint32_t f_e_mask = _uint32_li( 0x7f800000 );
344
- const uint32_t f_m_mask = _uint32_li( 0x007fffff );
345
- const uint32_t f_m_hidden_bit = _uint32_li( 0x00800000 );
346
- const uint32_t f_m_round_bit = _uint32_li( 0x00001000 );
347
- const uint32_t f_snan_mask = _uint32_li( 0x7fc00000 );
348
- const uint32_t f_e_pos = _uint32_li( 0x00000017 );
349
- const uint32_t h_e_pos = _uint32_li( 0x00000009 );
350
- const uint32_t h_e_mask = _uint32_li( 0x00007e00 );
351
- const uint32_t h_snan_mask = _uint32_li( 0x00007f00 );
352
- const uint32_t h_e_mask_value = _uint32_li( 0x0000003f );
353
- const uint32_t f_h_s_pos_offset = _uint32_li( 0x00000010 );
354
- const uint32_t f_h_bias_offset = _uint32_li( 0x00000050 );
355
- const uint32_t f_h_m_pos_offset = _uint32_li( 0x0000000e );
356
- const uint32_t h_nan_min = _uint32_li( 0x00007e01 );
357
- const uint32_t f_h_e_biased_flag = _uint32_li( 0x000000af );
342
+ const uint32_t f_s_mask = _uint32_li( 0x80000000 ); //bit 31
343
+ const uint32_t f_e_mask = _uint32_li( 0x7f800000 ); //bits 30-23
344
+ const uint32_t f_m_mask = _uint32_li( 0x007fffff ); //bits 22-0
345
+ const uint32_t f_m_hidden_bit = _uint32_li( 0x00800000 ); //1<<f_e_pos
346
+ const uint32_t f_m_round_bit = _uint32_li( 0x00002000 ); //1<<(f_e_pos - h_e_pos - 1)
347
+ const uint32_t f_snan_mask = _uint32_li( 0x7fc00000 ); //f_e_mask + 1 << (f_e_pos - 1)
348
+ const uint32_t f_e_pos = _uint32_li( 0x00000017 ); //23
349
+ const uint32_t h_e_pos = _uint32_li( 0x00000009 ); //9
350
+ const uint32_t h_e_mask = _uint32_li( 0x00007e00 ); //bits 14-9
351
+ const uint32_t h_snan_mask = _uint32_li( 0x00007f00 ); //h_e_mask + 1 << (h_e_pos - 1)
352
+ const uint32_t h_e_mask_value = _uint32_li( 0x0000003f ); //h_e_mask >> 9
353
+ const uint32_t f_h_s_pos_offset = _uint32_li( 0x00000010 ); //f_s_pos - h_s_pos
354
+ const uint32_t f_h_bias_offset = _uint32_li( 0x00000050 ); //f_bias - h_bias
355
+ const uint32_t f_h_m_pos_offset = _uint32_li( 0x0000000e ); //f_e_pos - h_e_pos
356
+ const uint32_t h_nan_min = _uint32_li( 0x00007e01 ); //h_e_mask + 1
357
+ const uint32_t f_h_e_biased_flag = _uint32_li( 0x000000af ); //f_bias + h_bias + 1
358
358
  const uint32_t f_s = _uint32_and( f, f_s_mask );
359
359
  const uint32_t f_e = _uint32_and( f, f_e_mask );
360
360
  const uint16_t h_s = _uint32_srl( f_s, f_h_s_pos_offset );
@@ -403,18 +403,18 @@ pghalf_from_float( uint32_t f )
403
403
  uint32_t
404
404
  pghalf_to_float( uint16_t h )
405
405
  {
406
- const uint32_t h_e_mask = _uint32_li( 0x00007e00 );
407
- const uint32_t h_m_mask = _uint32_li( 0x000001ff );
408
- const uint32_t h_s_mask = _uint32_li( 0x00008000 );
409
- const uint32_t h_f_s_pos_offset = _uint32_li( 0x00000010 );
410
- const uint32_t h_f_e_pos_offset = _uint32_li( 0x0000000e );
411
- const uint32_t h_f_bias_offset = _uint32_li( 0x0000a000 );
412
- const uint32_t f_e_mask = _uint32_li( 0x7f800000 );
413
- const uint32_t f_m_mask = _uint32_li( 0x007fffff );
414
- const uint32_t h_f_e_denorm_bias = _uint32_li( 0x0000005f );
415
- const uint32_t h_f_m_denorm_sa_bias = _uint32_li( 0x00000008 );
416
- const uint32_t f_e_pos = _uint32_li( 0x00000017 );
417
- const uint32_t h_e_mask_minus_one = _uint32_li( 0x00007dff );
406
+ const uint32_t h_e_mask = _uint32_li( 0x00007e00 ); //bits 14-9
407
+ const uint32_t h_m_mask = _uint32_li( 0x000001ff ); //bits 8-0
408
+ const uint32_t h_s_mask = _uint32_li( 0x00008000 ); //bit 15
409
+ const uint32_t h_f_s_pos_offset = _uint32_li( 0x00000010 ); //f_s_pos - h_s_pos
410
+ const uint32_t h_f_e_pos_offset = _uint32_li( 0x0000000e ); //f_m_bitcount - h_m_bitcount
411
+ const uint32_t h_f_bias_offset = _uint32_li( 0x0000a000 ); //(f_bias - h_bias) << 9
412
+ const uint32_t f_e_mask = _uint32_li( 0x7f800000 ); //bits 30-23
413
+ const uint32_t f_m_mask = _uint32_li( 0x007fffff ); //bits 22-0
414
+ const uint32_t h_f_e_denorm_bias = _uint32_li( 0x0000005f ); //h_f_e_pos_offset + 1 + (f_bias - h_bias)
415
+ const uint32_t h_f_m_denorm_sa_bias = _uint32_li( 0x00000008 ); //float exp bit count
416
+ const uint32_t f_e_pos = _uint32_li( 0x00000017 ); //23
417
+ const uint32_t h_e_mask_minus_one = _uint32_li( 0x00007dff ); //h_e_mask + h_m_mask - 1<<h_e_pos
418
418
  const uint32_t h_e = _uint32_and( h, h_e_mask );
419
419
  const uint32_t h_m = _uint32_and( h, h_m_mask );
420
420
  const uint32_t h_s = _uint32_and( h, h_s_mask );
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'libbin'
3
- s.version = "1.0.2"
3
+ s.version = "1.0.3"
4
4
  s.author = "Brice Videau"
5
5
  s.email = "brice.videau@imag.fr"
6
6
  s.homepage = "https://github.com/kerilk/libbin"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libbin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brice Videau