dotgnu-libjit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-libjit] Arithmetic operations and type-coercions for byte, short


From: Jan Wedekind
Subject: [Dotgnu-libjit] Arithmetic operations and type-coercions for byte, short int, ...
Date: Sun, 7 Sep 2008 11:28:19 +0100 (BST)

5AHi,
  I'm developing a Ruby-extension for doing computer vision [1] with the
Ruby programming language and I am thinking about replacing the current C++ template implementation with an implementation based on
libjit and ruby-libjit [2].
  I need to generate code to do element-wise unary operations
(such as +,-) and binary (scalar-array,array-scalar,array-array) operations (such as +,-,*,/,**,minor,major). The element-types of the
two arrays can be various combinations of char, unsigned char, unsigned
short int, ...
  I noted that adding to 8-bit values with libjit results in a 32 bit
integer. Since I don't want to overwrite succeeding elements in the array,
I need to convert the result back to 8-bit. A performance comparison shows
that this also has an impact on the performance (see below).
I had a look at the methods "common_binary" and "apply_arith" and I am wondering whether one could extend the code to support coercions resulting
in 8- or 16-bit values as well.
  Please let me know what you think and tell me if I overlooked something.
It would be really cool if I could get the same performance as a C/C++
implementation.

Regards
Jan

[1] http://www.wedesoft.demon.co.uk/hornetseye-api/
[2] http://github.com/cout/ruby-libjit/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]