|
MononcQc posted:I realized that I have not frequently needed to make these decisions at a conscious level and I have no good heuristic. do you have a specific use case? aside from high school dimensional analysis or hw-constraints, there's not much too it that'll apply much higher
|
# ? Aug 21, 2018 21:48 |
|
|
# ? May 7, 2024 06:31 |
|
kinda neat
|
# ? Aug 22, 2018 03:00 |
|
JawnV6 posted:do you have a specific use case? aside from high school dimensional analysis or hw-constraints, there's not much too it that'll apply much higher Nah not really. I mean I have been programming in languages with bignums for most of my career, and I mostly just winged it when I handled binary protocols. So you end up going with sizes based on how many types you want to represent, and for types something like "this is a 32 bit unsigned integer as a size tag, if you need more you just gotta use this additional continuation flag" and realized I had no good mechanism to choose aside from trying to guess.
|
# ? Aug 22, 2018 15:19 |
|
MononcQc posted:Nah not really. I mean I have been programming in languages with bignums for most of my career, and I mostly just winged it when I handled binary protocols. So you end up going with sizes based on how many types you want to represent, and for types something like "this is a 32 bit unsigned integer as a size tag, if you need more you just gotta use this additional continuation flag" and realized I had no good mechanism to choose aside from trying to guess. as someone in the process of learning lower level programming i totally get where you're coming from. this has always made me super anxious and i'm glad you asked. my experience so far has been that you usually have some hardware constraints or similar that are informing your decisions. other than that, absent some specific requirement, i think it's either "the most performant thing you can get away with on the platform", or "the safest thing you can get away with on the platform" (just like higher level programming). but like, take this with a massive grain of salt, i'm definitely in the middle of learning.
|
# ? Aug 22, 2018 15:33 |
|
MALE SHOEGAZE posted:as someone in the process of learning lower level programming i totally get where you're coming from. this has always made me super anxious and i'm glad you asked. if you don't care the best case is probably the machine word size. doing stuff in C like: code:
then you also sometimes have to worry about misaligned memory access, which can bite you if you're not careful. for example, on some arch that requires aligned memory access, say you are trying to write to a binary blob somewhere, and the format is defined as: code:
code:
|
# ? Aug 22, 2018 15:55 |
|
^^I have a feeling some of that might be germane to my question . Ok, I don't fully understand the rotation the emulator101 author is doing, and I'm also a little bit confused about his C. Does it look like I've translated this correctly? I'm not sure that it's wrong, I just want to check it off my list of things that could be broken. author's code: https://github.com/kpmiller/emulator101/blob/master/CocoaPart3-Attract/InvadersView.m#L61 code:
code:
this relatively simple rotation is melting my brain so i think we can rule out graphics stuff for me. DONT THREAD ON ME fucked around with this message at 16:14 on Aug 22, 2018 |
# ? Aug 22, 2018 16:06 |
|
"I do not understand what this is testing, but I think it's correct anyhow." space invaders uses 1-bit color, so it's on/off. in a single byte it represents 8 pixels, but in the target buffer it expects each pixel to be 32-bit (0xAARRGGBB probably). the for loop is basically doing code:
CRIP EATIN BREAD fucked around with this message at 16:20 on Aug 22, 2018 |
# ? Aug 22, 2018 16:16 |
|
CRIP EATIN BREAD posted:"I do not understand what this is testing, but I think it's correct anyhow." thanks, that made it click for me.
|
# ? Aug 22, 2018 16:21 |
|
You do you have one problem: in the C code, p1 is an unsigned int* so p1 -= 224 is actually moving p1 back by 224 * sizeof(unsigned int) bytes, ie, 224 * 4 bytes. But in your code, you're working with byte offsets directly, so you need to do offset -= 224 * 4 (which is the actual size in bytes of one row because it's 32bpp).
Lime fucked around with this message at 20:55 on Aug 22, 2018 |
# ? Aug 22, 2018 20:50 |
|
oops doublepost
|
# ? Aug 22, 2018 20:51 |
|
Lime posted:You do you have one problem: in the C code, p1 is an unsigned int* so p1 -= 224 is actually moving p1 back by 224 * sizeof(unsigned int) bytes, ie, 224 * 4 bytes. But in your code, you're working with byte offsets directly, so you need to do offset -= 224 * 4 (which is the actual size in bytes of one row because it's 32bpp). !!!!!!!!!!!!!!!
|
# ? Aug 22, 2018 21:07 |
|
NICE!
|
# ? Aug 22, 2018 21:12 |
|
CPColin posted:NICE!
|
# ? Aug 22, 2018 21:17 |
|
I can't wait to see how slowly my code is going to draw that first screen!
|
# ? Aug 22, 2018 21:18 |
|
CPColin posted:I can't wait to see how slowly my code is going to draw that first screen! it's pretty incredible that the cpu loop needs to run ~200k times per second in order to hit the target of 2mhz, which is insanely slow by modern standards. i've definitely never written a loop that hot. and yet i still need to clamp it. anyhow, here's how things look in action: https://imgur.com/a/oNQBA0G it's smoother than it looks, i think it's chunky because the gif is only 15fps. i havent done input yet, so this is just the demo loop, which i'm hoping is supposed to be random because things are not looking very deterministic atm. sometimes it will hit a bug (either an unimplemented op or an out of range access) and sometimes it will keep running. also aliens look missing. DONT THREAD ON ME fucked around with this message at 22:24 on Aug 22, 2018 |
# ? Aug 22, 2018 22:18 |
|
hows the rust plugin for intellij doing these days?
|
# ? Aug 22, 2018 22:31 |
|
CRIP EATIN BREAD posted:hows the rust plugin for intellij doing these days? rls continues to be really slow and rls+vscode basically destroys my laptop. honestly i'd probably be on rls+vscode if not for the slowness, because i do prefer the editor. emacs also has some basic rls integration and it seems okay, but i'm in the middle of overhauling my emacs setup and haven't really invested in learning it yet. the community is pretty audibly frustrated over rls mostly being not a good experience. DONT THREAD ON ME fucked around with this message at 22:42 on Aug 22, 2018 |
# ? Aug 22, 2018 22:38 |
|
rls just crashes nonstop
|
# ? Aug 22, 2018 23:12 |
|
MALE SHOEGAZE posted:I've spent a good deal of time with both rls+vscode and intellij+plugin and while I prefer vscode greatly as an editor, i have a much better experience overall with the intellij plugin. better completion (still a crapshoot) and it can fill out trait implementations which is a big deal for me. Bloody posted:rls just crashes nonstop this is my experience yep. RLS is..really, really, really not there yet, and it's frustrating they're pushing it to 1.0 for marketing.
|
# ? Aug 22, 2018 23:31 |
|
ever since I moved to various JetBrains platforms I have no desire to go back. I still use vim for everything C related, but otherwise it’s IDEA for pretty much everything. Most of my professional work these days is Java/Kotlin, but sometimes I need to touch other stuff. last time I checked the rust plugin it had some showstopping issues, although I don’t remember what those were. I’m pretty positive it was pre-1.0, though.
|
# ? Aug 22, 2018 23:33 |
|
i casually checked out pycharm the other day with low expectations because i have had some negative historical interactions with various jetbrains tools but i was blown away at how good it was at everything
|
# ? Aug 22, 2018 23:34 |
|
i am slowly trying to move as much of my development as i can into intellij just rewrote a few tiny sample websphere apps into kotlin too
|
# ? Aug 22, 2018 23:40 |
|
CRIP EATIN BREAD posted:ever since I moved to various JetBrains platforms I have no desire to go back. I still use vim for everything C related, but otherwise it’s IDEA for pretty much everything. Most of my professional work these days is Java/Kotlin, but sometimes I need to touch other stuff. it's good now also they're pretty quick to respond to issues
|
# ? Aug 22, 2018 23:41 |
|
MALE SHOEGAZE posted:it's pretty incredible that the cpu loop needs to run ~200k times per second in order to hit the target of 2mhz, which is insanely slow by modern standards. i've definitely never written a loop that hot. and yet i still need to clamp it. this is incredibly cool
|
# ? Aug 22, 2018 23:46 |
|
i think once it's done imna see about targeting wasm. that would honestly be cool. CRIP EATIN BREAD posted:ever since I moved to various JetBrains platforms I have no desire to go back. I still use vim for everything C related, but otherwise its IDEA for pretty much everything. Most of my professional work these days is Java/Kotlin, but sometimes I need to touch other stuff. i'm good with intellij, i just don't love it. i think i could invest in learning it better but overall i just don't enjoy the editing experience.
|
# ? Aug 22, 2018 23:50 |
|
carry on then posted:i am slowly trying to move as much of my development as i can into intellij kotlin owns so much. the coroutines built into the compiler own a lot, too.
|
# ? Aug 22, 2018 23:50 |
|
as a terrible python programmer is kotlin a good option for a second not-javascript language? I mostly want to see how I like strict typing and maybe work towards having another set of tools besides django for backend development
|
# ? Aug 23, 2018 00:21 |
|
Spime Wrangler posted:as a terrible python programmer is kotlin a good option for a second not-javascript language? yeah i haven't worked with it but i think kotlin is a good choice for that use case. java proper or C# would probably also suit your needs. ideally we'd be able to recommend server side swift but i dont think adoption is there yet. DONT THREAD ON ME fucked around with this message at 00:26 on Aug 23, 2018 |
# ? Aug 23, 2018 00:24 |
|
Spime Wrangler posted:as a terrible python programmer is kotlin a good option for a second not-javascript language? learn java then if you like it give kotlin a go. there's nothing in kotlin that's a super killer feature imo it's just a generally nice and well polished language on the jvm.
|
# ? Aug 23, 2018 00:36 |
|
CPColin posted:NICE!
|
# ? Aug 23, 2018 01:05 |
|
Blinkz0rz posted:learn java then if you like it give kotlin a go. there's nothing in kotlin that's a super killer feature imo it's just a generally nice and well polished language on the jvm. sounds suspiciously like you’re telling me to eat my vegetables
|
# ? Aug 23, 2018 05:25 |
|
Spime Wrangler posted:sounds suspiciously like you’re telling me to eat my vegetables Yeah I'm not sure I'd recommend java to somebody messing around and trying static types
|
# ? Aug 23, 2018 08:15 |
|
gonadic io posted:Yeah I'm not sure I'd recommend java to somebody messing around and trying static types Hmm static types are incredibly verbose and inflexible and get in my way Nope that's just java
|
# ? Aug 23, 2018 08:16 |
|
java 10 has local variable type inference
|
# ? Aug 23, 2018 08:18 |
|
ime its still verbose w/ the type inference cuz you need to deal with the rest of javaworld
|
# ? Aug 23, 2018 08:21 |
|
Sapozhnik posted:java 10 has local variable type inference so does kotlin plus smart-casting code:
|
# ? Aug 23, 2018 13:08 |
|
CRIP EATIN BREAD posted:smart-casting no such thing
|
# ? Aug 23, 2018 13:53 |
|
MALE SHOEGAZE posted:no such thing works fine in starcraft 2 actually
|
# ? Aug 23, 2018 14:51 |
|
Sapozhnik posted:java 10 has local variable type inference so does java 8, if you’re not allergic to lombok
|
# ? Aug 23, 2018 18:39 |
|
|
# ? May 7, 2024 06:31 |
|
Soricidus posted:so does java 8, if you’re not allergic to lombok lombok is super bad.
|
# ? Aug 23, 2018 19:20 |