Hi folks,

another round of patches, available at:

https://github.com/StefanBruens/libsigrok.git for_upstream_20160424

The first patch is trivial, while patch 2-4 may need some discussion. Patches 
2-4 include unit tests for the new methods.

[2] The parsing method is primarily targeted at SCPI, but may be usefull in 
otherwise, so I made it an SR_API method. SCPI specifies a range of +-9.9E37 
while sr_rational only supports +-9.2E18. I don't think this is a real issue 
as this is beyond any physical parameter we will see in practice.

[3] The equality check is exact, but requires int64 -> __int_128 
multiplication. This is supported natively by GCC 4.8 and beyond, and VS2015. 
In case this is an issue, the multiplication can be implemented in pure C, 
although with a slight performance loss.

[4] The sr_rational multiplication needs int64 multiplications as well. As 
long as the resulting nominator/denominator fits into (u)int64, this always 
works. In case one of the two is to large, reduction by power-of-two is done 
(this should be determine and use the gcd, but this is left for later).

Kind regards,

Stefan


Stefan Brüns (4):
  hameg-hmo: Add PATTern and BUS1/BUS2 trigger sources
  strutil: add method to get an sr_rational from a string
  analog: Add equality check for sr_rational
  analog: Implement multiplication for sr_rational

 include/libsigrok/proto.h         |  4 +++
 src/analog.c                      | 67 ++++++++++++++++++++++++++++++++++++
 src/hardware/hameg-hmo/protocol.c |  6 ++++
 src/strutil.c                     | 71 ++++++++++++++++++++++++++++++++++++++
 tests/analog.c                    | 58 ++++++++++++++++++++++++++++++++
 tests/strutil.c                   | 50 +++++++++++++++++++++++++++
 6 files changed, 256 insertions(+)



-- 
Stefan Brüns  /  Bergstraße 21  /  52062 Aachen
home: +49 241 53809034     mobile: +49 151 50412019
work: +49 2405 49936-424

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to