We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HesaiLidar_Swift_ROS/pandar_pointcloud/src/conversions/driver.cc
Line 144 in 284f8b8
按照文档年月日时分秒都是ascii字符,解析时直接减去0x30(ascii的‘0’)即可得到对应的数值。 目前的实现digit & 0xff - 0x30,我理解本意应该是(digit & 0xff) - 0x30,其实也就等价于digit - 0x30。 但是digit & 0xff - 0x30按照运算符优先级其实等价于digit & (0xff - 0x30),应该不是编码人的本意的,即其实等价于digit & 0b11001111;而digiet对应'0'-'9'的取值范围是0b00110000 - 0b00111001,运算后正好能确保左边4个bit取值为0,留下来右边4个bit,获得正确的数值。
digit & 0xff - 0x30
(digit & 0xff) - 0x30
digit - 0x30
digit & (0xff - 0x30)
digit & 0b11001111
咱就是说驱动能不能多少看一下编译器的warning啊……
The text was updated successfully, but these errors were encountered:
No branches or pull requests
HesaiLidar_Swift_ROS/pandar_pointcloud/src/conversions/driver.cc
Line 144 in 284f8b8
按照文档年月日时分秒都是ascii字符,解析时直接减去0x30(ascii的‘0’)即可得到对应的数值。
目前的实现
digit & 0xff - 0x30
,我理解本意应该是(digit & 0xff) - 0x30
,其实也就等价于digit - 0x30
。但是
digit & 0xff - 0x30
按照运算符优先级其实等价于digit & (0xff - 0x30)
,应该不是编码人的本意的,即其实等价于digit & 0b11001111
;而digiet对应'0'-'9'的取值范围是0b00110000 - 0b00111001,运算后正好能确保左边4个bit取值为0,留下来右边4个bit,获得正确的数值。咱就是说驱动能不能多少看一下编译器的warning啊……
The text was updated successfully, but these errors were encountered: