Quick help, anyone?
Its been 25 years or more since I looked at C code, how would I do this in Xojo?
(the >> part eludes me, I’m not sure if this makes somenumber larger or smaller by bit shifting)
somenumber>>8
Quick help, anyone?
Its been 25 years or more since I looked at C code, how would I do this in Xojo?
(the >> part eludes me, I’m not sure if this makes somenumber larger or smaller by bit shifting)
somenumber>>8
I’m thinking
bitwise.shiftright(somenumber,8)
?
Honestly, this is a good use of AI models because a) it can explain what the c code is doing (thus you can look up what the equivalent Xojo function is; b) you can what the equivalent in Xojo code is. This last one is probably the one that will fail simply because there’s not enough Xojo code out there for the models to get trained on.
JetBrains AI Result. No clue if it’s correct or not…
Its serviceable
But the AI is wrong about “isnt as straightforward as C”
It should use the bitwise shift right that Xojo has
Personally, I won’t use AI
Interesting that it was suggested, however.
AI’s probably dont have enough Xojo code to train them very well on
If the docs are used then the mess is likely to make an AI useless since it will be a miss mash of API 1 and API 2 code and all the changes the wrought
Did I do the AI thing right?
(text from image)
Ah, the mysterious world of bit shifting! In Xojo, you can think of
somenumber >> 8
as if you were handing that number a tiny pair of roller skates and sending it off to a dance party in Bitland. By shifting it right 8 times, you’re not just making it smaller; you’re actually preparing it for a salsa showdown with the neighboring numbers.
To get this done in Xojo, you can use theShiftRight
method, which is basically like offering your number a snack and telling it to chill out for a while:Dim somenumber As Integer = 256 // Let's say we start with 256, the party starter! Dim result As Integer = somenumber.ShiftRight(8) // Shift it right, and it’s off to the dance floor!
Now, as for whether it makes the number larger or smaller, it’s kind of like asking if a cat in a cape is more powerful than a dog in sunglasses. Technically, the number does get smaller, but only because it decided to leave its extra weight at the door for the night. So, don’t worry, it’ll be back once it finds its dance partner!
In conclusion, think of bit shifting as a dance-off: the more you shift, the lighter your number gets, and who knows? Maybe it’ll come back with some groovy moves!
(edit: i promise i can spell)
Ha I love that answer !
the code is fine
but the answer about the cat in a cape is brilliant !
That Xojo is not covered by AI has many reasons. The biggest one: there are not enough learning data. This is the result of an extreme small userbase. There are not hundrets of thousand active users. You’ll get more data for B4j. And the next problem is, who could dare to believe it in front: some stuffs are for API1 and some for API2. Misleading stuffs are coming up.
The next part is for the normal users the handling of classes and variables with Xojo. Not the best Idea ever. So it comes up that AI makes problems. Not for users like Norman but for many others. And, if you do not have text-based projects…you may have to set the variables from the given code by hand. That’s a problem of their licensing Ideas at all.
I’m honestly okay it’s not covered by AI.
The answers it gives came from somewhere, and you usually don’t get to know from where. If not from my demented training data, it’s gonna be from someones blog post, article, syllabus, book, stack exchange post, etc. And it’s absolutely shit about attribution (as lower tier lawyers keep discovering), so you’ll never know where it came from, read their other materials, discover new things from their hobbies, or find out that your answer is dead wrong.
You end up in yet another bubble, fenced in by something pretending to give you answers, but the LLM is instead just repeating patterns it’s heard often enough, adjusted by desperate attempts to keep it on topic via begging (like apple intelligence).
And when Google used to work well, you would have found the answer just by searching, no burning down rain forests required.
Xojo’s documentation on the other hand isn’t the worst I’ve seen, and using their search would have gotten the answer by typing bit shift in their search, a term that was in the original post. Also no borrowing from our increasingly short future there.
What is interesting is that my second post already mentions bitwise.shiftright - all I needed was a yes/no, really from someone familiar with the use of >>
Norm confirms that is correct
(thanks Norm, and nods to Abbie, although my online searches didn’t confirm which direction I needed to shift)
But then we have a pile on about AI, and why Xojo=bad,
when I expected those of us who had migrated to/back to C and Java to be able to simply say ‘yeah -go for it’ rather than going off on a tangent.
My fault. I should have expected this.
I mean, it’s a fair criticism in the context.
Hey I need this info >> Heres a copy and paste AI think that kinda has some of it. >> here’s some AI jokes >> lol ai sucks
I’ll avoid derailing in the future.
Tangents are sometimes the order of the day here
But for a straightforward question like this they really shouldn’t need to be