M
Mrki [MCAD]
I have a rather interesting code with 3 input variables that produce
result (this is a decoder and written by unknown author).
I have to get cd variable by konwing cl, fm and result of the
function...
is this possible?
Code:
#define MAKE_TAG_ID( cl, fm, cd)\
((((UL)(cl)) << ((TB -1) * 8)) | (((UL)(fm)) << ((TB -1) * 8)) |
(MAKE_TAG_ID_CODE (((UL)(cd)))))
And this is related code:
#define MAKE_TAG_ID_CODE(cd)\
( (cd < 31) ? (MAKE_TAG_ID_CODE1 (cd)):\
((cd < 128)? (MAKE_TAG_ID_CODE2 (cd)):\
((cd < 16384)? (MAKE_TAG_ID_CODE3 (cd)):\
(MAKE_TAG_ID_CODE4 (cd)))))
#define MAKE_TAG_ID_CODE1(cd) (cd << ((TB -1) * 8))
#define MAKE_TAG_ID_CODE2(cd) ((31 << ((TB -1) * 8)) | (cd << ((TB-2)
* 8)))
#define MAKE_TAG_ID_CODE3(cd) ((31 << ((TB -1) * 8))\
| ((cd & 0x3f80) << 9)\
| ( 0x0080 << ((TB-2) * 8))\
| ((cd & 0x007F) << ((TB-3)* 8)))
#define MAKE_TAG_ID_CODE4(cd) ((31 << ((TB -1) * 8))\
| ((cd & 0x1fc000) << 2)\
| ( 0x0080 << ((TB-2) * 8))\
| ((cd & 0x3f80) << 1)\
| ( 0x0080 << ((TB-3) * 8))\
| ((cd & 0x007F) << ((TB-4)*8)))
Thanx for any help
result (this is a decoder and written by unknown author).
I have to get cd variable by konwing cl, fm and result of the
function...
is this possible?
Code:
#define MAKE_TAG_ID( cl, fm, cd)\
((((UL)(cl)) << ((TB -1) * 8)) | (((UL)(fm)) << ((TB -1) * 8)) |
(MAKE_TAG_ID_CODE (((UL)(cd)))))
And this is related code:
#define MAKE_TAG_ID_CODE(cd)\
( (cd < 31) ? (MAKE_TAG_ID_CODE1 (cd)):\
((cd < 128)? (MAKE_TAG_ID_CODE2 (cd)):\
((cd < 16384)? (MAKE_TAG_ID_CODE3 (cd)):\
(MAKE_TAG_ID_CODE4 (cd)))))
#define MAKE_TAG_ID_CODE1(cd) (cd << ((TB -1) * 8))
#define MAKE_TAG_ID_CODE2(cd) ((31 << ((TB -1) * 8)) | (cd << ((TB-2)
* 8)))
#define MAKE_TAG_ID_CODE3(cd) ((31 << ((TB -1) * 8))\
| ((cd & 0x3f80) << 9)\
| ( 0x0080 << ((TB-2) * 8))\
| ((cd & 0x007F) << ((TB-3)* 8)))
#define MAKE_TAG_ID_CODE4(cd) ((31 << ((TB -1) * 8))\
| ((cd & 0x1fc000) << 2)\
| ( 0x0080 << ((TB-2) * 8))\
| ((cd & 0x3f80) << 1)\
| ( 0x0080 << ((TB-3) * 8))\
| ((cd & 0x007F) << ((TB-4)*8)))
Thanx for any help