question about bitfields to decode websocket header

test test at gmail.com
Wed Nov 7 13:05:49 UTC 2018


I am confused about the bitfields order.

mixin(bitfields!(
	bool, 	"fin",     	1,
	bool,   "rsv1", 	1,
	bool,   "rsv2", 	1,
	bool,   "rsv3", 	1,
	Opcode, "opcode", 	4,
		
	bool,   "mask", 	1,
	ubyte,  "_size", 	7,
));


output for first byte is 10000001 ,  the 2st byte 10000011

my code output:  opcode=8 mask=true size=65

the real size is 3 byte, and opcode is 1;

how to fix this ?



More information about the Digitalmars-d-learn mailing list