Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVCD::subdispatch [NOT READY] #34

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

mschuldt
Copy link
Contributor

SVCD.subdispatch

@@ -1,9 +1,13 @@
//This file is included into native.c
#include "libstormarray.h"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be included in native.c by #30

men in #000000

@mccormickt12
Copy link

@leonardt why would char not be an 8bit type?

@joseoyola
Copy link

While @leonardt is right and it never hurts to be extra careful, I think it's probably safe to assume that a char is an 8bit type. There are some implementations that will have a 16- or 32-bit char type, but they're usually called differently (e.g. char16_t or char32_t)
-PB4J

lua_pushnumber(L, ivkid);
lua_settable(L, -3);

}else if (cmd == 0){ //unsubscribe command

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in svcd.lua, 2 is the unsubscribe command, not 0.
Fantastic Four

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, in subdispatch it is. But in SVCD.unsubscribe it is 0 so we changed it here so everything would work

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this a bug in unsubscribe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was a bug in the program as a whole, I'm not sure which they meant it to be

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant it to be 2, but I will fix it when I merge, as this is my bad.

@NickFirmani
Copy link

Looks good to me (Nick)

-Axis

@leonardt
Copy link

leonardt commented Mar 1, 2015

@mschuldt A char is only guaranteed to be at least 8 bits (could be longer). In general it's considered good practice to not assume this (defensive programming, especially in the embedded and systems world, prevents bugs and security concerns). It's the same reason why you use malloc(1024 * sizeof(float)) instead of malloc(1024 * 4) even though most CPUs implement the IEEE standard 4 byte float.

@pnigam
Copy link

pnigam commented Mar 1, 2015

Your comments were very helpful when going through the code. I like how you kept track of the stack throughout.
Holy Cow

@jenniferdai
Copy link

Looks good to me.

-birdpeople

@mschuldt
Copy link
Contributor Author

mschuldt commented Mar 1, 2015

@jwqchen
line 262 is a comment
If you mean the table from line 258 then I don't think so, becuase lua should automatically adjust the stack when the function returns.

lua_settable(L, -3);
}
return 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Good job on doing the comments. Line 224-228 is fantastic! Took me a while to understand the reasoning.

Untitled

@immesys immesys changed the title Svcd Svcd.subdispatch Mar 2, 2015
@immesys immesys changed the title Svcd.subdispatch SVCD::subdispatch Mar 2, 2015
//local cmd = parr:get(1);
char cmd = parr[0];
//local svc_id = parr:get_as(storm.array.UINT16,1);
int16_t svc_id = *(int16_t*)(parr+1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot do an unaligned access like this on ARM. See my other ranty comments for people doing unaligned writes.

@immesys
Copy link
Contributor

immesys commented Mar 2, 2015

This looks nearly ready. Change your uint16_t accesses to be either aligned or bytewise and I will mark it ready

@immesys immesys changed the title SVCD::subdispatch SVCD::subdispatch [NOT READY] Mar 2, 2015
@mschuldt
Copy link
Contributor Author

mschuldt commented Mar 2, 2015

fixes have been pushed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.