nio4r 1.1.0-java → 1.1.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +58 -0
- data/.rubocop_todo.yml +35 -0
- data/.travis.yml +8 -1
- data/CHANGES.md +7 -0
- data/Gemfile +2 -2
- data/Rakefile +1 -1
- data/examples/echo_server.rb +6 -7
- data/ext/libev/Changes +6 -1
- data/ext/libev/ev.c +179 -114
- data/ext/libev/ev.h +14 -7
- data/ext/nio4r/extconf.rb +23 -34
- data/ext/nio4r/selector.c +6 -0
- data/lib/nio.rb +15 -13
- data/lib/nio/monitor.rb +8 -4
- data/lib/nio/selector.rb +11 -11
- data/lib/nio/version.rb +1 -1
- data/nio4r.gemspec +4 -3
- data/spec/nio/acceptables_spec.rb +3 -3
- data/spec/nio/monitor_spec.rb +4 -3
- data/spec/nio/selectables/pipe_spec.rb +5 -5
- data/spec/nio/selectables/ssl_socket_spec.rb +12 -12
- data/spec/nio/selectables/tcp_socket_spec.rb +7 -7
- data/spec/nio/selectables/udp_socket_spec.rb +6 -6
- data/spec/nio/selector_spec.rb +4 -4
- data/spec/spec_helper.rb +7 -5
- data/spec/support/selectable_examples.rb +5 -5
- data/tasks/extension.rake +7 -7
- data/tasks/rspec.rake +2 -2
- data/tasks/rubocop.rake +3 -0
- metadata +23 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f741b81ac5ff1cd039e2bc1b179c8f06a57323c1
|
4
|
+
data.tar.gz: 3b18b56a1cbbd020a1b72ceaf2929d2430640e75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b90de9ff1589bd6bbad2226598aa31b9bc2bcf628c8abfd0e4fab644abe19743749998fc513f2a387cf001a64cf85c52903a94b6ecf6ed4f434a4af37feac170
|
7
|
+
data.tar.gz: 56b06a82a0d5c9489cd6612ec97aca4c2bbf397aa6699eddcad4502cbcc6c4e9dd3273a718060b420ffccb980746c3203a80c7544f50dbf8af717239af361863
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
#
|
2
|
+
# Deliberate style choices
|
3
|
+
#
|
4
|
+
|
5
|
+
LineLength:
|
6
|
+
Max: 100
|
7
|
+
|
8
|
+
Style/StringLiterals:
|
9
|
+
EnforcedStyle: double_quotes
|
10
|
+
|
11
|
+
Metrics/MethodLength:
|
12
|
+
CountComments: false
|
13
|
+
Max: 40
|
14
|
+
|
15
|
+
Metrics/AbcSize:
|
16
|
+
Max: 40
|
17
|
+
|
18
|
+
Metrics/PerceivedComplexity:
|
19
|
+
Max: 15
|
20
|
+
|
21
|
+
Metrics/CyclomaticComplexity:
|
22
|
+
Max: 10
|
23
|
+
|
24
|
+
Style/GlobalVars:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
#
|
28
|
+
# Auto-generated overrides
|
29
|
+
#
|
30
|
+
|
31
|
+
# Offense count: 2
|
32
|
+
Lint/HandleExceptions:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
# Offense count: 3
|
36
|
+
Lint/Loop:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
# Offense count: 1
|
40
|
+
Lint/NonLocalExitFromIterator:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
# Offense count: 7
|
44
|
+
Lint/UselessAssignment:
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
# Offense count: 1
|
48
|
+
# Configuration parameters: SupportedStyles, IndentOneStep.
|
49
|
+
Style/CaseIndentation:
|
50
|
+
IndentWhenRelativeTo: end
|
51
|
+
|
52
|
+
# Offense count: 1
|
53
|
+
Style/Documentation:
|
54
|
+
Enabled: false
|
55
|
+
|
56
|
+
# Offense count: 2
|
57
|
+
Style/RescueModifier:
|
58
|
+
Enabled: false
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2015-04-24 03:08:21 -0700 using RuboCop version 0.30.1.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
# Offense count: 2
|
9
|
+
Lint/HandleExceptions:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
# Offense count: 3
|
13
|
+
Lint/Loop:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
# Offense count: 1
|
17
|
+
Lint/NonLocalExitFromIterator:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
# Offense count: 7
|
21
|
+
Lint/UselessAssignment:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
# Offense count: 1
|
25
|
+
# Configuration parameters: SupportedStyles, IndentOneStep.
|
26
|
+
Style/CaseIndentation:
|
27
|
+
IndentWhenRelativeTo: end
|
28
|
+
|
29
|
+
# Offense count: 1
|
30
|
+
Style/Documentation:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
# Offense count: 2
|
34
|
+
Style/RescueModifier:
|
35
|
+
Enabled: false
|
data/.travis.yml
CHANGED
@@ -1,17 +1,24 @@
|
|
1
1
|
rvm:
|
2
|
-
- 1.9.3
|
3
2
|
- 2.0.0
|
4
3
|
- 2.1.1
|
4
|
+
- 2.2.2
|
5
5
|
- ruby-head
|
6
6
|
- jruby
|
7
7
|
- jruby-head
|
8
8
|
- rbx-2
|
9
9
|
|
10
|
+
env:
|
11
|
+
- NIO4R_PURE=false
|
12
|
+
- NIO4R_PURE=true
|
13
|
+
|
10
14
|
matrix:
|
15
|
+
fast_finish: true
|
11
16
|
allow_failures:
|
12
17
|
- rvm: ruby-head
|
13
18
|
- rvm: jruby-head
|
14
19
|
- rvm: rbx-2
|
20
|
+
- rvm: jruby
|
21
|
+
env: NIO4R_PURE=true
|
15
22
|
|
16
23
|
notifications:
|
17
24
|
irc: "irc.freenode.org#celluloid"
|
data/CHANGES.md
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/examples/echo_server.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
require
|
5
|
-
require
|
3
|
+
$LOAD_PATH.push File.expand_path("../../lib", __FILE__)
|
4
|
+
require "nio"
|
5
|
+
require "socket"
|
6
6
|
|
7
|
+
# Echo server example written with nio4r
|
7
8
|
class EchoServer
|
8
9
|
def initialize(host, port)
|
9
10
|
@selector = NIO::Selector.new
|
@@ -16,7 +17,7 @@ class EchoServer
|
|
16
17
|
end
|
17
18
|
|
18
19
|
def run
|
19
|
-
|
20
|
+
loop do
|
20
21
|
@selector.select { |monitor| monitor.value.call(monitor) }
|
21
22
|
end
|
22
23
|
end
|
@@ -42,6 +43,4 @@ class EchoServer
|
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
45
|
-
if $
|
46
|
-
EchoServer.new("localhost", 1234).run
|
47
|
-
end
|
46
|
+
EchoServer.new("localhost", 1234).run if $PROGRAM_NAME == __FILE__
|
data/ext/libev/Changes
CHANGED
@@ -12,9 +12,14 @@ TODO: document file descriptor usage per loop
|
|
12
12
|
TODO: store loop pid_t and compare isndie signal handler,store 1 for same, 2 for differign pid, clean up in loop_fork
|
13
13
|
TODO: embed watchers need updating when fd changes
|
14
14
|
TODO: document portability requirements for atomic pointer access
|
15
|
-
TODO: possible cb aliasing?
|
16
15
|
TODO: document requirements for function pointers and calling conventions.
|
17
16
|
|
17
|
+
4.20 Sat Jun 20 13:01:43 CEST 2015
|
18
|
+
- prefer noexcept over throw () with C++ 11.
|
19
|
+
- update ecb.h due to incompatibilities with c11.
|
20
|
+
- fix a potential aliasing issue when reading and writing
|
21
|
+
watcher callbacks.
|
22
|
+
|
18
23
|
4.19 Thu Sep 25 08:18:25 CEST 2014
|
19
24
|
- ev.h wasn't valid C++ anymore, which tripped compilers other than
|
20
25
|
clang, msvc or gcc (analyzed by Raphael 'kena' Poss). Unfortunately,
|
data/ext/libev/ev.c
CHANGED
@@ -497,7 +497,7 @@ struct signalfd_siginfo
|
|
497
497
|
/*
|
498
498
|
* libecb - http://software.schmorp.de/pkg/libecb
|
499
499
|
*
|
500
|
-
* Copyright (©) 2009-
|
500
|
+
* Copyright (©) 2009-2015 Marc Alexander Lehmann <libecb@schmorp.de>
|
501
501
|
* Copyright (©) 2011 Emanuele Giaquinta
|
502
502
|
* All rights reserved.
|
503
503
|
*
|
@@ -538,7 +538,7 @@ struct signalfd_siginfo
|
|
538
538
|
#define ECB_H
|
539
539
|
|
540
540
|
/* 16 bits major, 16 bits minor */
|
541
|
-
#define ECB_VERSION
|
541
|
+
#define ECB_VERSION 0x00010004
|
542
542
|
|
543
543
|
#ifdef _WIN32
|
544
544
|
typedef signed char int8_t;
|
@@ -572,8 +572,11 @@ struct signalfd_siginfo
|
|
572
572
|
#endif
|
573
573
|
#endif
|
574
574
|
|
575
|
+
#define ECB_GCC_AMD64 (__amd64 || __amd64__ || __x86_64 || __x86_64__)
|
576
|
+
#define ECB_MSVC_AMD64 (_M_AMD64 || _M_X64)
|
577
|
+
|
575
578
|
/* work around x32 idiocy by defining proper macros */
|
576
|
-
#if
|
579
|
+
#if ECB_GCC_AMD64 || ECB_MSVC_AMD64
|
577
580
|
#if _ILP32
|
578
581
|
#define ECB_AMD64_X32 1
|
579
582
|
#else
|
@@ -588,12 +591,24 @@ struct signalfd_siginfo
|
|
588
591
|
* we try to detect these and simply assume they are not gcc - if they have
|
589
592
|
* an issue with that they should have done it right in the first place.
|
590
593
|
*/
|
591
|
-
#
|
592
|
-
#
|
593
|
-
|
594
|
-
#
|
595
|
-
|
596
|
-
|
594
|
+
#if !defined __GNUC_MINOR__ || defined __INTEL_COMPILER || defined __SUNPRO_C || defined __SUNPRO_CC || defined __llvm__ || defined __clang__
|
595
|
+
#define ECB_GCC_VERSION(major,minor) 0
|
596
|
+
#else
|
597
|
+
#define ECB_GCC_VERSION(major,minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
|
598
|
+
#endif
|
599
|
+
|
600
|
+
#define ECB_CLANG_VERSION(major,minor) (__clang_major__ > (major) || (__clang_major__ == (major) && __clang_minor__ >= (minor)))
|
601
|
+
|
602
|
+
#if __clang__ && defined __has_builtin
|
603
|
+
#define ECB_CLANG_BUILTIN(x) __has_builtin (x)
|
604
|
+
#else
|
605
|
+
#define ECB_CLANG_BUILTIN(x) 0
|
606
|
+
#endif
|
607
|
+
|
608
|
+
#if __clang__ && defined __has_extension
|
609
|
+
#define ECB_CLANG_EXTENSION(x) __has_extension (x)
|
610
|
+
#else
|
611
|
+
#define ECB_CLANG_EXTENSION(x) 0
|
597
612
|
#endif
|
598
613
|
|
599
614
|
#define ECB_CPP (__cplusplus+0)
|
@@ -633,13 +648,18 @@ struct signalfd_siginfo
|
|
633
648
|
#define ECB_MEMORY_FENCE do { } while (0)
|
634
649
|
#endif
|
635
650
|
|
651
|
+
/* http://www-01.ibm.com/support/knowledgecenter/SSGH3R_13.1.0/com.ibm.xlcpp131.aix.doc/compiler_ref/compiler_builtins.html */
|
652
|
+
#if __xlC__ && ECB_CPP
|
653
|
+
#include <builtins.h>
|
654
|
+
#endif
|
655
|
+
|
636
656
|
#ifndef ECB_MEMORY_FENCE
|
637
657
|
#if ECB_GCC_VERSION(2,5) || defined __INTEL_COMPILER || (__llvm__ && __GNUC__) || __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110
|
638
658
|
#if __i386 || __i386__
|
639
659
|
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("lock; orb $0, -1(%%esp)" : : : "memory")
|
640
660
|
#define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory")
|
641
661
|
#define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("")
|
642
|
-
#elif
|
662
|
+
#elif ECB_GCC_AMD64
|
643
663
|
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("mfence" : : : "memory")
|
644
664
|
#define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory")
|
645
665
|
#define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("")
|
@@ -687,16 +707,11 @@ struct signalfd_siginfo
|
|
687
707
|
#define ECB_MEMORY_FENCE_ACQUIRE __atomic_thread_fence (__ATOMIC_ACQUIRE)
|
688
708
|
#define ECB_MEMORY_FENCE_RELEASE __atomic_thread_fence (__ATOMIC_RELEASE)
|
689
709
|
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
* // see comment below (stdatomic.h) about the C11 memory model.
|
696
|
-
* #define ECB_MEMORY_FENCE __c11_atomic_thread_fence (__ATOMIC_SEQ_CST)
|
697
|
-
* #define ECB_MEMORY_FENCE_ACQUIRE __c11_atomic_thread_fence (__ATOMIC_ACQUIRE)
|
698
|
-
* #define ECB_MEMORY_FENCE_RELEASE __c11_atomic_thread_fence (__ATOMIC_RELEASE)
|
699
|
-
*/
|
710
|
+
#elif ECB_CLANG_EXTENSION(c_atomic)
|
711
|
+
/* see comment below (stdatomic.h) about the C11 memory model. */
|
712
|
+
#define ECB_MEMORY_FENCE __c11_atomic_thread_fence (__ATOMIC_SEQ_CST)
|
713
|
+
#define ECB_MEMORY_FENCE_ACQUIRE __c11_atomic_thread_fence (__ATOMIC_ACQUIRE)
|
714
|
+
#define ECB_MEMORY_FENCE_RELEASE __c11_atomic_thread_fence (__ATOMIC_RELEASE)
|
700
715
|
|
701
716
|
#elif ECB_GCC_VERSION(4,4) || defined __INTEL_COMPILER || defined __clang__
|
702
717
|
#define ECB_MEMORY_FENCE __sync_synchronize ()
|
@@ -769,7 +784,7 @@ struct signalfd_siginfo
|
|
769
784
|
|
770
785
|
/*****************************************************************************/
|
771
786
|
|
772
|
-
#if
|
787
|
+
#if ECB_CPP
|
773
788
|
#define ecb_inline static inline
|
774
789
|
#elif ECB_GCC_VERSION(2,5)
|
775
790
|
#define ecb_inline static __inline__
|
@@ -793,47 +808,79 @@ typedef int ecb_bool;
|
|
793
808
|
#define ECB_CONCAT(a, b) ECB_CONCAT_(a, b)
|
794
809
|
#define ECB_STRINGIFY_(a) # a
|
795
810
|
#define ECB_STRINGIFY(a) ECB_STRINGIFY_(a)
|
811
|
+
#define ECB_STRINGIFY_EXPR(expr) ((expr), ECB_STRINGIFY_ (expr))
|
796
812
|
|
797
813
|
#define ecb_function_ ecb_inline
|
798
814
|
|
799
|
-
#if ECB_GCC_VERSION(3,1)
|
800
|
-
#define ecb_attribute(attrlist) __attribute__(attrlist)
|
801
|
-
#define ecb_is_constant(expr) __builtin_constant_p (expr)
|
802
|
-
#define ecb_expect(expr,value) __builtin_expect ((expr),(value))
|
803
|
-
#define ecb_prefetch(addr,rw,locality) __builtin_prefetch (addr, rw, locality)
|
815
|
+
#if ECB_GCC_VERSION(3,1) || ECB_CLANG_VERSION(2,8)
|
816
|
+
#define ecb_attribute(attrlist) __attribute__ (attrlist)
|
804
817
|
#else
|
805
818
|
#define ecb_attribute(attrlist)
|
819
|
+
#endif
|
806
820
|
|
821
|
+
#if ECB_GCC_VERSION(3,1) || ECB_CLANG_BUILTIN(__builtin_constant_p)
|
822
|
+
#define ecb_is_constant(expr) __builtin_constant_p (expr)
|
823
|
+
#else
|
807
824
|
/* possible C11 impl for integral types
|
808
825
|
typedef struct ecb_is_constant_struct ecb_is_constant_struct;
|
809
826
|
#define ecb_is_constant(expr) _Generic ((1 ? (struct ecb_is_constant_struct *)0 : (void *)((expr) - (expr)), ecb_is_constant_struct *: 0, default: 1)) */
|
810
827
|
|
811
828
|
#define ecb_is_constant(expr) 0
|
829
|
+
#endif
|
830
|
+
|
831
|
+
#if ECB_GCC_VERSION(3,1) || ECB_CLANG_BUILTIN(__builtin_expect)
|
832
|
+
#define ecb_expect(expr,value) __builtin_expect ((expr),(value))
|
833
|
+
#else
|
812
834
|
#define ecb_expect(expr,value) (expr)
|
835
|
+
#endif
|
836
|
+
|
837
|
+
#if ECB_GCC_VERSION(3,1) || ECB_CLANG_BUILTIN(__builtin_prefetch)
|
838
|
+
#define ecb_prefetch(addr,rw,locality) __builtin_prefetch (addr, rw, locality)
|
839
|
+
#else
|
813
840
|
#define ecb_prefetch(addr,rw,locality)
|
814
841
|
#endif
|
815
842
|
|
816
843
|
/* no emulation for ecb_decltype */
|
817
|
-
#if
|
818
|
-
|
819
|
-
|
820
|
-
#define ecb_decltype(x)
|
844
|
+
#if ECB_CPP11
|
845
|
+
// older implementations might have problems with decltype(x)::type, work around it
|
846
|
+
template<class T> struct ecb_decltype_t { typedef T type; };
|
847
|
+
#define ecb_decltype(x) ecb_decltype_t<decltype (x)>::type
|
848
|
+
#elif ECB_GCC_VERSION(3,0) || ECB_CLANG_VERSION(2,8)
|
849
|
+
#define ecb_decltype(x) __typeof__ (x)
|
821
850
|
#endif
|
822
851
|
|
823
852
|
#if _MSC_VER >= 1300
|
824
|
-
#define ecb_deprecated __declspec(deprecated)
|
853
|
+
#define ecb_deprecated __declspec (deprecated)
|
825
854
|
#else
|
826
855
|
#define ecb_deprecated ecb_attribute ((__deprecated__))
|
827
856
|
#endif
|
828
857
|
|
829
|
-
#
|
858
|
+
#if _MSC_VER >= 1500
|
859
|
+
#define ecb_deprecated_message(msg) __declspec (deprecated (msg))
|
860
|
+
#elif ECB_GCC_VERSION(4,5)
|
861
|
+
#define ecb_deprecated_message(msg) ecb_attribute ((__deprecated__ (msg))
|
862
|
+
#else
|
863
|
+
#define ecb_deprecated_message(msg) ecb_deprecated
|
864
|
+
#endif
|
865
|
+
|
866
|
+
#if _MSC_VER >= 1400
|
867
|
+
#define ecb_noinline __declspec (noinline)
|
868
|
+
#else
|
869
|
+
#define ecb_noinline ecb_attribute ((__noinline__))
|
870
|
+
#endif
|
871
|
+
|
830
872
|
#define ecb_unused ecb_attribute ((__unused__))
|
831
873
|
#define ecb_const ecb_attribute ((__const__))
|
832
874
|
#define ecb_pure ecb_attribute ((__pure__))
|
833
875
|
|
834
|
-
|
835
|
-
|
876
|
+
#if ECB_C11 || __IBMC_NORETURN
|
877
|
+
/* http://www-01.ibm.com/support/knowledgecenter/SSGH3R_13.1.0/com.ibm.xlcpp131.aix.doc/language_ref/noreturn.html */
|
836
878
|
#define ecb_noreturn _Noreturn
|
879
|
+
#elif ECB_CPP11
|
880
|
+
#define ecb_noreturn [[noreturn]]
|
881
|
+
#elif _MSC_VER >= 1200
|
882
|
+
/* http://msdn.microsoft.com/en-us/library/k6ktzx3s.aspx */
|
883
|
+
#define ecb_noreturn __declspec (noreturn)
|
837
884
|
#else
|
838
885
|
#define ecb_noreturn ecb_attribute ((__noreturn__))
|
839
886
|
#endif
|
@@ -858,7 +905,10 @@ typedef int ecb_bool;
|
|
858
905
|
#define ecb_unlikely(expr) ecb_expect_false (expr)
|
859
906
|
|
860
907
|
/* count trailing zero bits and count # of one bits */
|
861
|
-
#if ECB_GCC_VERSION(3,4)
|
908
|
+
#if ECB_GCC_VERSION(3,4) \
|
909
|
+
|| (ECB_CLANG_BUILTIN(__builtin_clz) && ECB_CLANG_BUILTIN(__builtin_clzll) \
|
910
|
+
&& ECB_CLANG_BUILTIN(__builtin_ctz) && ECB_CLANG_BUILTIN(__builtin_ctzll) \
|
911
|
+
&& ECB_CLANG_BUILTIN(__builtin_popcount))
|
862
912
|
/* we assume int == 32 bit, long == 32 or 64 bit and long long == 64 bit */
|
863
913
|
#define ecb_ld32(x) (__builtin_clz (x) ^ 31)
|
864
914
|
#define ecb_ld64(x) (__builtin_clzll (x) ^ 63)
|
@@ -867,8 +917,8 @@ typedef int ecb_bool;
|
|
867
917
|
#define ecb_popcount32(x) __builtin_popcount (x)
|
868
918
|
/* no popcountll */
|
869
919
|
#else
|
870
|
-
ecb_function_ int ecb_ctz32 (uint32_t x)
|
871
|
-
ecb_function_ int
|
920
|
+
ecb_function_ ecb_const int ecb_ctz32 (uint32_t x);
|
921
|
+
ecb_function_ ecb_const int
|
872
922
|
ecb_ctz32 (uint32_t x)
|
873
923
|
{
|
874
924
|
int r = 0;
|
@@ -892,16 +942,16 @@ typedef int ecb_bool;
|
|
892
942
|
return r;
|
893
943
|
}
|
894
944
|
|
895
|
-
ecb_function_ int ecb_ctz64 (uint64_t x)
|
896
|
-
ecb_function_ int
|
945
|
+
ecb_function_ ecb_const int ecb_ctz64 (uint64_t x);
|
946
|
+
ecb_function_ ecb_const int
|
897
947
|
ecb_ctz64 (uint64_t x)
|
898
948
|
{
|
899
949
|
int shift = x & 0xffffffffU ? 0 : 32;
|
900
950
|
return ecb_ctz32 (x >> shift) + shift;
|
901
951
|
}
|
902
952
|
|
903
|
-
ecb_function_ int ecb_popcount32 (uint32_t x)
|
904
|
-
ecb_function_ int
|
953
|
+
ecb_function_ ecb_const int ecb_popcount32 (uint32_t x);
|
954
|
+
ecb_function_ ecb_const int
|
905
955
|
ecb_popcount32 (uint32_t x)
|
906
956
|
{
|
907
957
|
x -= (x >> 1) & 0x55555555;
|
@@ -912,8 +962,8 @@ typedef int ecb_bool;
|
|
912
962
|
return x >> 24;
|
913
963
|
}
|
914
964
|
|
915
|
-
ecb_function_ int ecb_ld32 (uint32_t x)
|
916
|
-
ecb_function_ int ecb_ld32 (uint32_t x)
|
965
|
+
ecb_function_ ecb_const int ecb_ld32 (uint32_t x);
|
966
|
+
ecb_function_ ecb_const int ecb_ld32 (uint32_t x)
|
917
967
|
{
|
918
968
|
int r = 0;
|
919
969
|
|
@@ -926,8 +976,8 @@ typedef int ecb_bool;
|
|
926
976
|
return r;
|
927
977
|
}
|
928
978
|
|
929
|
-
ecb_function_ int ecb_ld64 (uint64_t x)
|
930
|
-
ecb_function_ int ecb_ld64 (uint64_t x)
|
979
|
+
ecb_function_ ecb_const int ecb_ld64 (uint64_t x);
|
980
|
+
ecb_function_ ecb_const int ecb_ld64 (uint64_t x)
|
931
981
|
{
|
932
982
|
int r = 0;
|
933
983
|
|
@@ -937,20 +987,20 @@ typedef int ecb_bool;
|
|
937
987
|
}
|
938
988
|
#endif
|
939
989
|
|
940
|
-
ecb_function_ ecb_bool ecb_is_pot32 (uint32_t x)
|
941
|
-
ecb_function_ ecb_bool ecb_is_pot32 (uint32_t x) { return !(x & (x - 1)); }
|
942
|
-
ecb_function_ ecb_bool ecb_is_pot64 (uint64_t x)
|
943
|
-
ecb_function_ ecb_bool ecb_is_pot64 (uint64_t x) { return !(x & (x - 1)); }
|
990
|
+
ecb_function_ ecb_const ecb_bool ecb_is_pot32 (uint32_t x);
|
991
|
+
ecb_function_ ecb_const ecb_bool ecb_is_pot32 (uint32_t x) { return !(x & (x - 1)); }
|
992
|
+
ecb_function_ ecb_const ecb_bool ecb_is_pot64 (uint64_t x);
|
993
|
+
ecb_function_ ecb_const ecb_bool ecb_is_pot64 (uint64_t x) { return !(x & (x - 1)); }
|
944
994
|
|
945
|
-
ecb_function_ uint8_t ecb_bitrev8 (uint8_t x)
|
946
|
-
ecb_function_ uint8_t ecb_bitrev8 (uint8_t x)
|
995
|
+
ecb_function_ ecb_const uint8_t ecb_bitrev8 (uint8_t x);
|
996
|
+
ecb_function_ ecb_const uint8_t ecb_bitrev8 (uint8_t x)
|
947
997
|
{
|
948
998
|
return ( (x * 0x0802U & 0x22110U)
|
949
|
-
| (x * 0x8020U & 0x88440U)) * 0x10101U >> 16;
|
999
|
+
| (x * 0x8020U & 0x88440U)) * 0x10101U >> 16;
|
950
1000
|
}
|
951
1001
|
|
952
|
-
ecb_function_ uint16_t ecb_bitrev16 (uint16_t x)
|
953
|
-
ecb_function_ uint16_t ecb_bitrev16 (uint16_t x)
|
1002
|
+
ecb_function_ ecb_const uint16_t ecb_bitrev16 (uint16_t x);
|
1003
|
+
ecb_function_ ecb_const uint16_t ecb_bitrev16 (uint16_t x)
|
954
1004
|
{
|
955
1005
|
x = ((x >> 1) & 0x5555) | ((x & 0x5555) << 1);
|
956
1006
|
x = ((x >> 2) & 0x3333) | ((x & 0x3333) << 2);
|
@@ -960,8 +1010,8 @@ ecb_function_ uint16_t ecb_bitrev16 (uint16_t x)
|
|
960
1010
|
return x;
|
961
1011
|
}
|
962
1012
|
|
963
|
-
ecb_function_ uint32_t ecb_bitrev32 (uint32_t x)
|
964
|
-
ecb_function_ uint32_t ecb_bitrev32 (uint32_t x)
|
1013
|
+
ecb_function_ ecb_const uint32_t ecb_bitrev32 (uint32_t x);
|
1014
|
+
ecb_function_ ecb_const uint32_t ecb_bitrev32 (uint32_t x)
|
965
1015
|
{
|
966
1016
|
x = ((x >> 1) & 0x55555555) | ((x & 0x55555555) << 1);
|
967
1017
|
x = ((x >> 2) & 0x33333333) | ((x & 0x33333333) << 2);
|
@@ -974,71 +1024,80 @@ ecb_function_ uint32_t ecb_bitrev32 (uint32_t x)
|
|
974
1024
|
|
975
1025
|
/* popcount64 is only available on 64 bit cpus as gcc builtin */
|
976
1026
|
/* so for this version we are lazy */
|
977
|
-
ecb_function_ int ecb_popcount64 (uint64_t x)
|
978
|
-
ecb_function_ int
|
1027
|
+
ecb_function_ ecb_const int ecb_popcount64 (uint64_t x);
|
1028
|
+
ecb_function_ ecb_const int
|
979
1029
|
ecb_popcount64 (uint64_t x)
|
980
1030
|
{
|
981
1031
|
return ecb_popcount32 (x) + ecb_popcount32 (x >> 32);
|
982
1032
|
}
|
983
1033
|
|
984
|
-
ecb_inline uint8_t ecb_rotl8 (uint8_t x, unsigned int count)
|
985
|
-
ecb_inline uint8_t ecb_rotr8 (uint8_t x, unsigned int count)
|
986
|
-
ecb_inline uint16_t ecb_rotl16 (uint16_t x, unsigned int count)
|
987
|
-
ecb_inline uint16_t ecb_rotr16 (uint16_t x, unsigned int count)
|
988
|
-
ecb_inline uint32_t ecb_rotl32 (uint32_t x, unsigned int count)
|
989
|
-
ecb_inline uint32_t ecb_rotr32 (uint32_t x, unsigned int count)
|
990
|
-
ecb_inline uint64_t ecb_rotl64 (uint64_t x, unsigned int count)
|
991
|
-
ecb_inline uint64_t ecb_rotr64 (uint64_t x, unsigned int count)
|
992
|
-
|
993
|
-
ecb_inline uint8_t ecb_rotl8 (uint8_t x, unsigned int count) { return (x >> ( 8 - count)) | (x << count); }
|
994
|
-
ecb_inline uint8_t ecb_rotr8 (uint8_t x, unsigned int count) { return (x << ( 8 - count)) | (x >> count); }
|
995
|
-
ecb_inline uint16_t ecb_rotl16 (uint16_t x, unsigned int count) { return (x >> (16 - count)) | (x << count); }
|
996
|
-
ecb_inline uint16_t ecb_rotr16 (uint16_t x, unsigned int count) { return (x << (16 - count)) | (x >> count); }
|
997
|
-
ecb_inline uint32_t ecb_rotl32 (uint32_t x, unsigned int count) { return (x >> (32 - count)) | (x << count); }
|
998
|
-
ecb_inline uint32_t ecb_rotr32 (uint32_t x, unsigned int count) { return (x << (32 - count)) | (x >> count); }
|
999
|
-
ecb_inline uint64_t ecb_rotl64 (uint64_t x, unsigned int count) { return (x >> (64 - count)) | (x << count); }
|
1000
|
-
ecb_inline uint64_t ecb_rotr64 (uint64_t x, unsigned int count) { return (x << (64 - count)) | (x >> count); }
|
1001
|
-
|
1002
|
-
#if ECB_GCC_VERSION(4,3)
|
1034
|
+
ecb_inline ecb_const uint8_t ecb_rotl8 (uint8_t x, unsigned int count);
|
1035
|
+
ecb_inline ecb_const uint8_t ecb_rotr8 (uint8_t x, unsigned int count);
|
1036
|
+
ecb_inline ecb_const uint16_t ecb_rotl16 (uint16_t x, unsigned int count);
|
1037
|
+
ecb_inline ecb_const uint16_t ecb_rotr16 (uint16_t x, unsigned int count);
|
1038
|
+
ecb_inline ecb_const uint32_t ecb_rotl32 (uint32_t x, unsigned int count);
|
1039
|
+
ecb_inline ecb_const uint32_t ecb_rotr32 (uint32_t x, unsigned int count);
|
1040
|
+
ecb_inline ecb_const uint64_t ecb_rotl64 (uint64_t x, unsigned int count);
|
1041
|
+
ecb_inline ecb_const uint64_t ecb_rotr64 (uint64_t x, unsigned int count);
|
1042
|
+
|
1043
|
+
ecb_inline ecb_const uint8_t ecb_rotl8 (uint8_t x, unsigned int count) { return (x >> ( 8 - count)) | (x << count); }
|
1044
|
+
ecb_inline ecb_const uint8_t ecb_rotr8 (uint8_t x, unsigned int count) { return (x << ( 8 - count)) | (x >> count); }
|
1045
|
+
ecb_inline ecb_const uint16_t ecb_rotl16 (uint16_t x, unsigned int count) { return (x >> (16 - count)) | (x << count); }
|
1046
|
+
ecb_inline ecb_const uint16_t ecb_rotr16 (uint16_t x, unsigned int count) { return (x << (16 - count)) | (x >> count); }
|
1047
|
+
ecb_inline ecb_const uint32_t ecb_rotl32 (uint32_t x, unsigned int count) { return (x >> (32 - count)) | (x << count); }
|
1048
|
+
ecb_inline ecb_const uint32_t ecb_rotr32 (uint32_t x, unsigned int count) { return (x << (32 - count)) | (x >> count); }
|
1049
|
+
ecb_inline ecb_const uint64_t ecb_rotl64 (uint64_t x, unsigned int count) { return (x >> (64 - count)) | (x << count); }
|
1050
|
+
ecb_inline ecb_const uint64_t ecb_rotr64 (uint64_t x, unsigned int count) { return (x << (64 - count)) | (x >> count); }
|
1051
|
+
|
1052
|
+
#if ECB_GCC_VERSION(4,3) || (ECB_CLANG_BUILTIN(__builtin_bswap32) && ECB_CLANG_BUILTIN(__builtin_bswap64))
|
1053
|
+
#if ECB_GCC_VERSION(4,8) || ECB_CLANG_BUILTIN(__builtin_bswap16)
|
1054
|
+
#define ecb_bswap16(x) __builtin_bswap16 (x)
|
1055
|
+
#else
|
1003
1056
|
#define ecb_bswap16(x) (__builtin_bswap32 (x) >> 16)
|
1057
|
+
#endif
|
1004
1058
|
#define ecb_bswap32(x) __builtin_bswap32 (x)
|
1005
1059
|
#define ecb_bswap64(x) __builtin_bswap64 (x)
|
1060
|
+
#elif _MSC_VER
|
1061
|
+
#include <stdlib.h>
|
1062
|
+
#define ecb_bswap16(x) ((uint16_t)_byteswap_ushort ((uint16_t)(x)))
|
1063
|
+
#define ecb_bswap32(x) ((uint32_t)_byteswap_ulong ((uint32_t)(x)))
|
1064
|
+
#define ecb_bswap64(x) ((uint64_t)_byteswap_uint64 ((uint64_t)(x)))
|
1006
1065
|
#else
|
1007
|
-
ecb_function_ uint16_t ecb_bswap16 (uint16_t x)
|
1008
|
-
ecb_function_ uint16_t
|
1066
|
+
ecb_function_ ecb_const uint16_t ecb_bswap16 (uint16_t x);
|
1067
|
+
ecb_function_ ecb_const uint16_t
|
1009
1068
|
ecb_bswap16 (uint16_t x)
|
1010
1069
|
{
|
1011
1070
|
return ecb_rotl16 (x, 8);
|
1012
1071
|
}
|
1013
1072
|
|
1014
|
-
ecb_function_ uint32_t ecb_bswap32 (uint32_t x)
|
1015
|
-
ecb_function_ uint32_t
|
1073
|
+
ecb_function_ ecb_const uint32_t ecb_bswap32 (uint32_t x);
|
1074
|
+
ecb_function_ ecb_const uint32_t
|
1016
1075
|
ecb_bswap32 (uint32_t x)
|
1017
1076
|
{
|
1018
1077
|
return (((uint32_t)ecb_bswap16 (x)) << 16) | ecb_bswap16 (x >> 16);
|
1019
1078
|
}
|
1020
1079
|
|
1021
|
-
ecb_function_ uint64_t ecb_bswap64 (uint64_t x)
|
1022
|
-
ecb_function_ uint64_t
|
1080
|
+
ecb_function_ ecb_const uint64_t ecb_bswap64 (uint64_t x);
|
1081
|
+
ecb_function_ ecb_const uint64_t
|
1023
1082
|
ecb_bswap64 (uint64_t x)
|
1024
1083
|
{
|
1025
1084
|
return (((uint64_t)ecb_bswap32 (x)) << 32) | ecb_bswap32 (x >> 32);
|
1026
1085
|
}
|
1027
1086
|
#endif
|
1028
1087
|
|
1029
|
-
#if ECB_GCC_VERSION(4,5)
|
1088
|
+
#if ECB_GCC_VERSION(4,5) || ECB_CLANG_BUILTIN(__builtin_unreachable)
|
1030
1089
|
#define ecb_unreachable() __builtin_unreachable ()
|
1031
1090
|
#else
|
1032
1091
|
/* this seems to work fine, but gcc always emits a warning for it :/ */
|
1033
|
-
ecb_inline void ecb_unreachable (void)
|
1034
|
-
ecb_inline void ecb_unreachable (void) { }
|
1092
|
+
ecb_inline ecb_noreturn void ecb_unreachable (void);
|
1093
|
+
ecb_inline ecb_noreturn void ecb_unreachable (void) { }
|
1035
1094
|
#endif
|
1036
1095
|
|
1037
1096
|
/* try to tell the compiler that some condition is definitely true */
|
1038
1097
|
#define ecb_assume(cond) if (!(cond)) ecb_unreachable (); else 0
|
1039
1098
|
|
1040
|
-
ecb_inline unsigned char ecb_byteorder_helper (void)
|
1041
|
-
ecb_inline unsigned char
|
1099
|
+
ecb_inline ecb_const unsigned char ecb_byteorder_helper (void);
|
1100
|
+
ecb_inline ecb_const unsigned char
|
1042
1101
|
ecb_byteorder_helper (void)
|
1043
1102
|
{
|
1044
1103
|
/* the union code still generates code under pressure in gcc, */
|
@@ -1047,7 +1106,7 @@ ecb_byteorder_helper (void)
|
|
1047
1106
|
/* the reason why we have this horrible preprocessor mess */
|
1048
1107
|
/* is to avoid it in all cases, at least on common architectures */
|
1049
1108
|
/* or when using a recent enough gcc version (>= 4.6) */
|
1050
|
-
#if __i386 || __i386__
|
1109
|
+
#if ((__i386 || __i386__) && !__VOS__) || _M_IX86 || ECB_GCC_AMD64 || ECB_MSVC_AMD64
|
1051
1110
|
return 0x44;
|
1052
1111
|
#elif __BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
1053
1112
|
return 0x44;
|
@@ -1063,10 +1122,10 @@ ecb_byteorder_helper (void)
|
|
1063
1122
|
#endif
|
1064
1123
|
}
|
1065
1124
|
|
1066
|
-
ecb_inline ecb_bool ecb_big_endian (void)
|
1067
|
-
ecb_inline ecb_bool ecb_big_endian (void) { return ecb_byteorder_helper () == 0x11; }
|
1068
|
-
ecb_inline ecb_bool ecb_little_endian (void)
|
1069
|
-
ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == 0x44; }
|
1125
|
+
ecb_inline ecb_const ecb_bool ecb_big_endian (void);
|
1126
|
+
ecb_inline ecb_const ecb_bool ecb_big_endian (void) { return ecb_byteorder_helper () == 0x11; }
|
1127
|
+
ecb_inline ecb_const ecb_bool ecb_little_endian (void);
|
1128
|
+
ecb_inline ecb_const ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == 0x44; }
|
1070
1129
|
|
1071
1130
|
#if ECB_GCC_VERSION(3,0) || ECB_C99
|
1072
1131
|
#define ecb_mod(m,n) ((m) % (n) + ((m) % (n) < 0 ? (n) : 0))
|
@@ -1074,7 +1133,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
|
|
1074
1133
|
#define ecb_mod(m,n) ((m) < 0 ? ((n) - 1 - ((-1 - (m)) % (n))) : ((m) % (n)))
|
1075
1134
|
#endif
|
1076
1135
|
|
1077
|
-
#if
|
1136
|
+
#if ECB_CPP
|
1078
1137
|
template<typename T>
|
1079
1138
|
static inline T ecb_div_rd (T val, T div)
|
1080
1139
|
{
|
@@ -1108,7 +1167,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
|
|
1108
1167
|
/* the only noteworthy exception is ancient armle, which uses order 43218765 */
|
1109
1168
|
#if 0 \
|
1110
1169
|
|| __i386 || __i386__ \
|
1111
|
-
||
|
1170
|
+
|| ECB_GCC_AMD64 \
|
1112
1171
|
|| __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__ \
|
1113
1172
|
|| defined __s390__ || defined __s390x__ \
|
1114
1173
|
|| defined __mips__ \
|
@@ -1118,7 +1177,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
|
|
1118
1177
|
|| defined __m68k__ \
|
1119
1178
|
|| defined __m88k__ \
|
1120
1179
|
|| defined __sh__ \
|
1121
|
-
|| defined _M_IX86 || defined
|
1180
|
+
|| defined _M_IX86 || defined ECB_MSVC_AMD64 || defined _M_IA64 \
|
1122
1181
|
|| (defined __arm__ && (defined __ARM_EABI__ || defined __EABI__ || defined __VFP_FP__ || defined _WIN32_WCE || defined __ANDROID__)) \
|
1123
1182
|
|| defined __aarch64__
|
1124
1183
|
#define ECB_STDFP 1
|
@@ -1144,17 +1203,25 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
|
|
1144
1203
|
#define ECB_NAN ECB_INFINITY
|
1145
1204
|
#endif
|
1146
1205
|
|
1206
|
+
#if ECB_C99 || _XOPEN_VERSION >= 600 || _POSIX_VERSION >= 200112L
|
1207
|
+
#define ecb_ldexpf(x,e) ldexpf ((x), (e))
|
1208
|
+
#define ecb_frexpf(x,e) frexpf ((x), (e))
|
1209
|
+
#else
|
1210
|
+
#define ecb_ldexpf(x,e) (float) ldexp ((double) (x), (e))
|
1211
|
+
#define ecb_frexpf(x,e) (float) frexp ((double) (x), (e))
|
1212
|
+
#endif
|
1213
|
+
|
1147
1214
|
/* converts an ieee half/binary16 to a float */
|
1148
|
-
ecb_function_ float ecb_binary16_to_float (uint16_t x)
|
1149
|
-
ecb_function_ float
|
1215
|
+
ecb_function_ ecb_const float ecb_binary16_to_float (uint16_t x);
|
1216
|
+
ecb_function_ ecb_const float
|
1150
1217
|
ecb_binary16_to_float (uint16_t x)
|
1151
1218
|
{
|
1152
1219
|
int e = (x >> 10) & 0x1f;
|
1153
1220
|
int m = x & 0x3ff;
|
1154
1221
|
float r;
|
1155
1222
|
|
1156
|
-
if (!e ) r =
|
1157
|
-
else if (e != 31) r =
|
1223
|
+
if (!e ) r = ecb_ldexpf (m , -24);
|
1224
|
+
else if (e != 31) r = ecb_ldexpf (m + 0x400, e - 25);
|
1158
1225
|
else if (m ) r = ECB_NAN;
|
1159
1226
|
else r = ECB_INFINITY;
|
1160
1227
|
|
@@ -1162,8 +1229,8 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
|
|
1162
1229
|
}
|
1163
1230
|
|
1164
1231
|
/* convert a float to ieee single/binary32 */
|
1165
|
-
ecb_function_ uint32_t ecb_float_to_binary32 (float x)
|
1166
|
-
ecb_function_ uint32_t
|
1232
|
+
ecb_function_ ecb_const uint32_t ecb_float_to_binary32 (float x);
|
1233
|
+
ecb_function_ ecb_const uint32_t
|
1167
1234
|
ecb_float_to_binary32 (float x)
|
1168
1235
|
{
|
1169
1236
|
uint32_t r;
|
@@ -1180,7 +1247,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
|
|
1180
1247
|
if (x < -3.40282346638528860e+38f) return 0xff800000U;
|
1181
1248
|
if (x != x ) return 0x7fbfffffU;
|
1182
1249
|
|
1183
|
-
m =
|
1250
|
+
m = ecb_frexpf (x, &e) * 0x1000000U;
|
1184
1251
|
|
1185
1252
|
r = m & 0x80000000U;
|
1186
1253
|
|
@@ -1202,8 +1269,8 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
|
|
1202
1269
|
}
|
1203
1270
|
|
1204
1271
|
/* converts an ieee single/binary32 to a float */
|
1205
|
-
ecb_function_ float ecb_binary32_to_float (uint32_t x)
|
1206
|
-
ecb_function_ float
|
1272
|
+
ecb_function_ ecb_const float ecb_binary32_to_float (uint32_t x);
|
1273
|
+
ecb_function_ ecb_const float
|
1207
1274
|
ecb_binary32_to_float (uint32_t x)
|
1208
1275
|
{
|
1209
1276
|
float r;
|
@@ -1223,7 +1290,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
|
|
1223
1290
|
e = 1;
|
1224
1291
|
|
1225
1292
|
/* we distrust ldexpf a bit and do the 2**-24 scaling by an extra multiply */
|
1226
|
-
r =
|
1293
|
+
r = ecb_ldexpf (x * (0.5f / 0x800000U), e - 126);
|
1227
1294
|
|
1228
1295
|
r = neg ? -r : r;
|
1229
1296
|
#endif
|
@@ -1232,8 +1299,8 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
|
|
1232
1299
|
}
|
1233
1300
|
|
1234
1301
|
/* convert a double to ieee double/binary64 */
|
1235
|
-
ecb_function_ uint64_t ecb_double_to_binary64 (double x)
|
1236
|
-
ecb_function_ uint64_t
|
1302
|
+
ecb_function_ ecb_const uint64_t ecb_double_to_binary64 (double x);
|
1303
|
+
ecb_function_ ecb_const uint64_t
|
1237
1304
|
ecb_double_to_binary64 (double x)
|
1238
1305
|
{
|
1239
1306
|
uint64_t r;
|
@@ -1272,8 +1339,8 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
|
|
1272
1339
|
}
|
1273
1340
|
|
1274
1341
|
/* converts an ieee double/binary64 to a double */
|
1275
|
-
ecb_function_ double ecb_binary64_to_double (uint64_t x)
|
1276
|
-
ecb_function_ double
|
1342
|
+
ecb_function_ ecb_const double ecb_binary64_to_double (uint64_t x);
|
1343
|
+
ecb_function_ ecb_const double
|
1277
1344
|
ecb_binary64_to_double (uint64_t x)
|
1278
1345
|
{
|
1279
1346
|
double r;
|
@@ -3355,7 +3422,7 @@ VALUE ev_backend_poll(void *ptr)
|
|
3355
3422
|
int
|
3356
3423
|
ev_run (EV_P_ int flags)
|
3357
3424
|
{
|
3358
|
-
|
3425
|
+
/* ########## NIO4R PATCHERY HO! ########## */
|
3359
3426
|
#if defined(HAVE_RB_THREAD_BLOCKING_REGION) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)
|
3360
3427
|
struct ev_poll_args poll_args;
|
3361
3428
|
#endif
|
@@ -3526,10 +3593,8 @@ rb_thread_unsafe_dangerous_crazy_blocking_region_end(...);
|
|
3526
3593
|
|
3527
3594
|
#ifndef HAVE_RB_THREAD_CALL_WITHOUT_GVL
|
3528
3595
|
#ifdef HAVE_RB_THREAD_BLOCKING_REGION
|
3529
|
-
|
3530
3596
|
#define rb_thread_call_without_gvl(func, data1, ubf, data2) \
|
3531
3597
|
rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
|
3532
|
-
|
3533
3598
|
#endif
|
3534
3599
|
#endif
|
3535
3600
|
|
@@ -3538,7 +3603,7 @@ rb_thread_unsafe_dangerous_crazy_blocking_region_end(...);
|
|
3538
3603
|
poll_args.waittime = waittime;
|
3539
3604
|
rb_thread_call_without_gvl(ev_backend_poll, (void *)&poll_args, RUBY_UBF_IO, 0);
|
3540
3605
|
#else
|
3541
|
-
|
3606
|
+
backend_poll (EV_A_ waittime);
|
3542
3607
|
#endif
|
3543
3608
|
/*
|
3544
3609
|
############################# END PATCHERY ############################
|