Talk:ASCII art diagram converter: Difference between revisions
Content added Content deleted
(3 intermediate revisions by 3 users not shown) | |||
Line 11: | Line 11: | ||
--[[User:Smls|Smls]] ([[User talk:Smls|talk]]) 23:09, 30 January 2014 (UTC) |
--[[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> |
|||
The code there only worked on 32 bit, but it is fairly easy to fix. I'll do it now. |
|||
:which gives the test output: |
|||
== Promote to Task == |
|||
:<lang D>[0, 10, 56, 128, 0, 0, 0, 0, 0, 0, 0, 255]</lang> |
|||
This should be promoted from a draft task to a normal task. the task is fully defined and there are several implementations. Any feedback? |
|||
: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. |
|||
--[[User:DavidFashion|DavidFashion]] ([[User talk:DavidFashion|talk]]) 15:19, 5 February 2020 (UTC) |
|||
: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) |
Latest revision as of 15:20, 5 February 2020
D solution won't compile
I installed the Digital Mars D compiler version 2.064.2 on my Linux box (x86_64 architecture), copied the snippet into a file, and passed it to dmd - but it failed with this error:
$ dmd ascii_struct.d ascii_struct.d(121): Error: cannot implicitly convert expression ((line.length - 1LU) / 3LU) of type ulong to uint ascii_struct.d(139): Error: cannot implicitly convert expression ((field.length + 1LU) / 3LU) of type ulong to uint ascii_struct.d(188): Error: CTFE failed because of previous errors in makeStructFromDiagram
Are you sure that the code is correct?
--Smls (talk) 23:09, 30 January 2014 (UTC)
The code there only worked on 32 bit, but it is fairly easy to fix. I'll do it now.
Promote to Task
This should be promoted from a draft task to a normal task. the task is fully defined and there are several implementations. Any feedback?
--DavidFashion (talk) 15:19, 5 February 2020 (UTC)