Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
vector_integer.cpp@1:d043a9b85963, 2017-03-29 (annotated)
- Committer:
- cesarcazal
- Date:
- Wed Mar 29 02:17:17 2017 +0000
- Revision:
- 1:d043a9b85963
EJEMPLO NRF5X
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| cesarcazal | 1:d043a9b85963 | 1 | #include "vector_integer.h" |
| cesarcazal | 1:d043a9b85963 | 2 | #include "mbed.h" |
| cesarcazal | 1:d043a9b85963 | 3 | //LOS VALORES SON DEVUELTOS EN FORMATO INT32; SIN EMBARGO SOLO SE REALIZAN CONVERSIONES EQUIVALENTES A VARIABLES DE 24BITS |
| cesarcazal | 1:d043a9b85963 | 4 | |
| cesarcazal | 1:d043a9b85963 | 5 | int pointer_to_int(char *vect) { |
| cesarcazal | 1:d043a9b85963 | 6 | int aux1; |
| cesarcazal | 1:d043a9b85963 | 7 | int result=0; |
| cesarcazal | 1:d043a9b85963 | 8 | for (aux1 = 2; aux1>0; aux1--){ |
| cesarcazal | 1:d043a9b85963 | 9 | result= result|*(vect+aux1); |
| cesarcazal | 1:d043a9b85963 | 10 | result <<= 8; |
| cesarcazal | 1:d043a9b85963 | 11 | if((aux1==1)&&(*(vect+2)>127)) |
| cesarcazal | 1:d043a9b85963 | 12 | result = result|(0xff000000); |
| cesarcazal | 1:d043a9b85963 | 13 | } |
| cesarcazal | 1:d043a9b85963 | 14 | result= *vect|result; |
| cesarcazal | 1:d043a9b85963 | 15 | return (result); |
| cesarcazal | 1:d043a9b85963 | 16 | } |
| cesarcazal | 1:d043a9b85963 | 17 | |
| cesarcazal | 1:d043a9b85963 | 18 | void int_to_pointer (int dato, char *point){ |
| cesarcazal | 1:d043a9b85963 | 19 | *(point) = dato; |
| cesarcazal | 1:d043a9b85963 | 20 | *(point+1) = dato >> 8; |
| cesarcazal | 1:d043a9b85963 | 21 | *(point+2) = dato >> 16; |
| cesarcazal | 1:d043a9b85963 | 22 | *(point+3) = dato >> 24; |
| cesarcazal | 1:d043a9b85963 | 23 | } |