| ??? 02/06/07 07:33 Read: times |
#132108 - If you're worried about machine cycles Responding to: ???'s previous message |
P Ravi said:
... but this method consumes lot of machine cycles Are you sure? Have you checked the generated code? Many (most?) compilers would be smart enough to spot that actual shifts are not needed... ... now I want to know the alternate method of doing the same which consuming less no. of machine cycles. Charles Bannister said:
I used the below function ... If you're worried about machine cycles, you won't want to do it via a function call; however, the technique of using a union is certainly the way to go. The alternative would be to use pointers The advantage of using shifts is that it is entirely portable across different compilers & different targets; the union & pointers are entirely compiler-specific (possibly even specific to a particular version), as they require you to understand and rely upon the compiler's internal data representation... |
| Topic | Author | Date |
| assigning 4 bytes to a single long variable inSDCC | 01/01/70 00:00 | |
| Try this Function. | 01/01/70 00:00 | |
| If you're worried about machine cycles | 01/01/70 00:00 | |
| Unwise | 01/01/70 00:00 | |
| have you read the manual? | 01/01/70 00:00 | |
| do you now what a union is | 01/01/70 00:00 | |
| #2 | 01/01/70 00:00 | |
quted the relevant part... | 01/01/70 00:00 |



