什么<<用C ++表示? [英] What does << mean in C++?

查看:85
本文介绍了什么<<用C ++表示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下宏意味着什么,尤其是<<标志:


#define hello(x)((int64)floor((double)x)<< 32)


谢谢

Thierry

解决方案

Thierry Lam写道:


以下宏意味着什么,特别是<< sign:


#define hello(x)((int64)floor((double)x)<< 32)



你应该得到一本C ++书。这是一个非常基本的概念。 <<是位移

运算符。在这里,这意味着左侧的值应该是32位左移。


Rolf Magnus写道:


Thierry Lam写道:


以下宏意味着什么,特别是<< sign:


#define hello(x)((int64)floor((double)x)<< 32)



你应该得到一本C ++书。



同意。这里有一个好的,免费的:

http://mindview.net/Books/TICPP/ThinkingInCPP2e.html

或由Koenig和Moo获得_Accelerated C ++ _,这是最好的恕我直言。


干杯! --M


mlimber写道:


Rolf Magnus写道:
< blockquote class =post_quotes>
>> Thierry Lam写道:


>>>以下宏是什么意思是,特别是<< sign:

#define hello(x)((int64)floor((double)x)<< 32)


你应该得到一个C ++书。




同意。这里有一个好的,免费的:

http://mindview.net/Books/TICPP/ThinkingInCPP2e.html

或由Koenig和Moo获得_Accelerated C ++ _,这是最好的恕我直言。


干杯! --M



C ++与它无关......看起来它只是找到变量x的

数学底层(最大积分值小于

或等于x)并将其右移到4个最重要的字节......


What does the following macro mean, especially the << sign:

#define hello(x) (( int64 ) floor( (double) x ) << 32)

Thanks
Thierry

解决方案

Thierry Lam wrote:

What does the following macro mean, especially the << sign:

#define hello(x) (( int64 ) floor( (double) x ) << 32)

You should get a C++ book. This is a very basic concept. << is the bit shift
operator. Here, it means that the value on the left side should be shift
left by 32 bits.


Rolf Magnus wrote:

Thierry Lam wrote:

What does the following macro mean, especially the << sign:

#define hello(x) (( int64 ) floor( (double) x ) << 32)


You should get a C++ book.

Agreed. There''s a good, free one here:

http://mindview.net/Books/TICPP/ThinkingInCPP2e.html

or get _Accelerated C++_ by Koenig and Moo, which is the best IMHO.

Cheers! --M


mlimber wrote:

Rolf Magnus wrote:

>>Thierry Lam wrote:

>>>What does the following macro mean, especially the << sign:

#define hello(x) (( int64 ) floor( (double) x ) << 32)


You should get a C++ book.



Agreed. There''s a good, free one here:

http://mindview.net/Books/TICPP/ThinkingInCPP2e.html

or get _Accelerated C++_ by Koenig and Moo, which is the best IMHO.

Cheers! --M

C++ has nothing to do with it... looks like it is just finding the
mathematical floor of the variable x (largest integral value less than
or equal to x) and right shifting it into the 4 most significant bytes...


这篇关于什么&lt;&lt;用C ++表示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆