开发者

Erlang bit syntax variable issue

开发者 https://www.devze.com 2022-12-23 06:26 出处:网络
Is there any way to format this so it\'s a valid expression, without adding another step? <<One:8,_:(One*8)>> = <<1,9>>.

Is there any way to format this so it's a valid expression, without adding another step?

<<One:8,_:(One*8)>> = <<1,9>>.
* 1: illegal bit size

These work

>> <<One:8,_:8>> = <<1,9>>.              
<<1,9>>

>> One*8.
8

>> <<One:8,_:(1*8)>> = <<1,9>>.
<<1,9>>

>> <<Eight:8,_:Eight>> = <<8,9>>.  
<<8,9>>

I'm trying to parse a binary 开发者_如何转开发with nested data with binary list comprehensions instead of stacking accumulators.


Try this ;-)

<<Size:8,_:Size/unit:8>> = <<1,9>>.
0

精彩评论

暂无评论...
验证码 换一张
取 消