Talk:ASCII art diagram converter: Difference between revisions

need to rethink comments - D's output is numeric representation of octets
(need to rethink comments - D's output is numeric representation of octets)
Line 10:
Are you sure that the code is correct?<br>
--[[User:Smls|Smls]] ([[User talk:Smls|talk]]) 23:09, 30 January 2014 (UTC)
 
: Looking at the current implementation, it has the test data:
 
:<lang D> Header h;
h.ID = 10;
h.RA = true;
h.ARCOUNT = 255;
h.Opcode = 7;</lang>
 
:which gives the test output:
 
:<lang D>[0, 10, 56, 128, 0, 0, 0, 0, 0, 0, 0, 255]</lang>
 
:But note that the first number in the output is a zero and the second number is a 10. Meanwhile, the specification indicates that ID should be the first value. So that might be one issue.
 
:Note also that 56 corresponds to this bit sequence: 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 if we place the high order bits on the left (and RFC 1035 specifies "Whenever an octet represents a numeric quantity, the left most bit in the diagram is the high order or most significant bit"). Since opcode was 7, I would have instead expected a value of 7168.
 
:Anyways, it should not be hard for a good D programmer to fix that implementation. --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 15:52, 31 January 2014 (UTC)
6,951

edits