将数据转换回原始项目

Dyl*_*lan 2 c data-conversion shift

我有一些代码,我不明白如何获取单个项目:

u32_t foo = ((u32_t)((d) & 0xff) << 24) | ((u32_t)((c) & 0xff) << 16) |  
((u32_t)((b) & 0xff) << 8)  | (u32_t)((a) & 0xff)
Run Code Online (Sandbox Code Playgroud)

我想输入这个转换的结果我想要将IP地址转换回要显示的部分.但是当我输入192 168 1 200时,我得到0xC801A8C0而我没有将其转换回来.

有谁知道我如何在union结构中的项目?我尝试使用LwIP,但工会结构有问题.我尝试访问local_ip和remote_ip. 结构

Pyt*_*Ech 5

u32_t d = (foo >> 24) & 0xFF; // Get the bits 32nd...25th
u32_t c = (foo >> 16) & 0xFF; // 24th...17th
u32_t b = (foo >> 8) & 0xFF;  // 16th...9th
u32_t a = (foo) & 0xFF;       // 8th...1st
Run Code Online (Sandbox Code Playgroud)

这实际上与上面的代码相反.