本文介绍了聚合类型的算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨论坛,
有没有人知道有关聚合类型算术的资源?
我正在使用这样的附加:
Hi forum,
does anyone know of a resource covering arithmetic on aggregated types?
I'm using addition like this:
typedef struct
{
uint8_t hb;
uint8_t mb;
uint8_t lb;
}BunchOBytes;
BunchOBytes Add(BunchOBytes in0, BuncOBytes in1)
{
BunchOBytes result;
uint16_t sum;
sum = in0.lb + in1.lb;
result.lb = sum;
sum >>= 8;
sum += in0.mb + in1.mb;
result.mb = sum;
sum >>= 8;
sum += in0.hb + in0.hb;
result.hb = sum;
return(result); // handle overflow
}
现在我需要了由标量划分。任何人都可以推荐这本书吗?
Now I'm in need of division by a scalar. Can anyone recommend a book on this?
推荐答案
typedef struct
{
unsigned hb;
unsigned mb;
unsigned lb;
}BunchOBytes;
这篇关于聚合类型的算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!