mbed I/F binding for mruby

Dependents:   mruby_mbed_web mirb_mbed

mbed-mruby

How to use

Class

Committer:
mzta
Date:
Mon Apr 13 05:20:15 2015 +0000
Revision:
1:8ccd1d494a4b
Parent:
0:158c61bb030f
- code refactoring.; - add SPI, SPISlave, I2C class to mruby-mbed (Incomplete).

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mzta 0:158c61bb030f 1 #ifndef MRB_VALUE_ARRAY_H__
mzta 0:158c61bb030f 2 #define MRB_VALUE_ARRAY_H__
mzta 0:158c61bb030f 3
mzta 0:158c61bb030f 4 #include "mruby.h"
mzta 0:158c61bb030f 5
mzta 0:158c61bb030f 6 static inline void
mzta 0:158c61bb030f 7 value_move(mrb_value *s1, const mrb_value *s2, size_t n)
mzta 0:158c61bb030f 8 {
mzta 0:158c61bb030f 9 if (s1 > s2 && s1 < s2 + n)
mzta 0:158c61bb030f 10 {
mzta 0:158c61bb030f 11 s1 += n;
mzta 0:158c61bb030f 12 s2 += n;
mzta 0:158c61bb030f 13 while (n-- > 0) {
mzta 0:158c61bb030f 14 *--s1 = *--s2;
mzta 0:158c61bb030f 15 }
mzta 0:158c61bb030f 16 }
mzta 0:158c61bb030f 17 else if (s1 != s2) {
mzta 0:158c61bb030f 18 while (n-- > 0) {
mzta 0:158c61bb030f 19 *s1++ = *s2++;
mzta 0:158c61bb030f 20 }
mzta 0:158c61bb030f 21 }
mzta 0:158c61bb030f 22 else {
mzta 0:158c61bb030f 23 /* nothing to do. */
mzta 0:158c61bb030f 24 }
mzta 0:158c61bb030f 25 }
mzta 0:158c61bb030f 26
mzta 0:158c61bb030f 27 #endif /* MRB_VALUE_ARRAY_H__ */
mzta 0:158c61bb030f 28