{"action":"created","issue":{"url":"https://api.github.com/repos/ferreiradaselva/mathc/issues/8","repository_url":"https://api.github.com/repos/ferreiradaselva/mathc","labels_url":"https://api.github.com/repos/ferreiradaselva/mathc/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/ferreiradaselva/mathc/issues/8/comments","events_url":"https://api.github.com/repos/ferreiradaselva/mathc/issues/8/events","html_url":"https://github.com/ferreiradaselva/mathc/issues/8","id":267126527,"number":8,"title":"matrix_to_array functions","user":{"login":"nobledemon","id":198346,"avatar_url":"https://avatars0.githubusercontent.com/u/198346?v=4","gravatar_id":"","url":"https://api.github.com/users/nobledemon","html_url":"https://github.com/nobledemon","followers_url":"https://api.github.com/users/nobledemon/followers","following_url":"https://api.github.com/users/nobledemon/following{/other_user}","gists_url":"https://api.github.com/users/nobledemon/gists{/gist_id}","starred_url":"https://api.github.com/users/nobledemon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nobledemon/subscriptions","organizations_url":"https://api.github.com/users/nobledemon/orgs","repos_url":"https://api.github.com/users/nobledemon/repos","events_url":"https://api.github.com/users/nobledemon/events{/privacy}","received_events_url":"https://api.github.com/users/nobledemon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-10-20T10:06:32Z","updated_at":"2017-10-20T19:28:58Z","closed_at":null,"author_association":"NONE","body":"This is more of a (possibly) dumb question rather than an issue.\r\n\r\nReadme.md says:\r\n\r\n> If you want to modify on GPU-side, you can use the functions matrix_to_array() or pmatrix_to_array() to push the matrix to an array with 16 float elements. \r\n\r\nWouldn't it be possible to just cast the struct to float* since it's a pod struct? Is there a benefit to doing this way?"},"comment":{"url":"https://api.github.com/repos/ferreiradaselva/mathc/issues/comments/338301379","html_url":"https://github.com/ferreiradaselva/mathc/issues/8#issuecomment-338301379","issue_url":"https://api.github.com/repos/ferreiradaselva/mathc/issues/8","id":338301379,"user":{"login":"ferreiradaselva","id":4709242,"avatar_url":"https://avatars0.githubusercontent.com/u/4709242?v=4","gravatar_id":"","url":"https://api.github.com/users/ferreiradaselva","html_url":"https://github.com/ferreiradaselva","followers_url":"https://api.github.com/users/ferreiradaselva/followers","following_url":"https://api.github.com/users/ferreiradaselva/following{/other_user}","gists_url":"https://api.github.com/users/ferreiradaselva/gists{/gist_id}","starred_url":"https://api.github.com/users/ferreiradaselva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ferreiradaselva/subscriptions","organizations_url":"https://api.github.com/users/ferreiradaselva/orgs","repos_url":"https://api.github.com/users/ferreiradaselva/repos","events_url":"https://api.github.com/users/ferreiradaselva/events{/privacy}","received_events_url":"https://api.github.com/users/ferreiradaselva/received_events","type":"User","site_admin":false},"created_at":"2017-10-20T19:28:58Z","updated_at":"2017-10-20T19:28:58Z","author_association":"OWNER","body":"As far as I know, you can. I just didn't mention that, because I don't know if every compiler guarantee alignment.\r\n\r\nFrom [this stackoverflow](https://stackoverflow.com/a/5524587) answer:\r\n> If all members a guaranteed to be of type int you can use a pointer to int and increment it:\r\n```c\r\nint *value = &(values.v_move);\r\nint *quantity = &(quantities.qtt_move);\r\nint i;\r\naverage = 0;\r\n// although it should work, a good practice many times IMHO is to add a null as the last member in struct and change the condition to quantity[i] != null.\r\nfor (i = 0; i < sizeof(quantities) / sizeof(*quantity); i++)\r\n    average += values[i] * quantity[i];\r\n```"}}
{"actor":{"display_login":"ferreiradaselva"}}