[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


Janitor application acceptance emails are being sent out. Please remember to check your spam box!


[Advertise on 4chan]


What are you OLs working on?

Previous TPS report: >>107088464
>>
File: sombrita walking.gif (152 KB, 349x430)
152 KB
152 KB GIF
>>107113418
i'm not working at all
>>
Erlang is KING
>>
Are there any ways to simplify this? (searching for blocks of set/unset bits in a bitmap)
  template <bool BIT>
static constexpr u32 find_sequence(u64 *buckets, u32 num_buckets, u32 num_bits) {
u32 run = 0;
for (u32 bk = 0; bk < num_buckets; ++bk) {
u64 bucket = buckets[bk];
if (!BIT) bucket = ~bucket;
u32 bit = 0;
do {
if (bucket & 1) {
const u32 ones = tzcnt(~bucket);
run += ones;
bucket = ones == 64 ? 0 : bucket >> ones;
bit += ones;
if (run >= num_bits) return (bk * 64 + bit) - run;
if (bit < 64) run = 0;
} else {
const u32 zeroes = tzcnt(bucket);
run = 0;
bucket = zeroes == 64 ? 0 : bucket >> zeroes;
bit += zeroes;
}
if (!bucket) break;
} while (true);
}
return U32_MAX;
}
>>
>>107113418
how to get OL GF?
>>
File: carbon.png (247 KB, 1988x1020)
247 KB
247 KB PNG
I pressed F5 after writing all this shit down fml

>>107113513
>>107113160
This is how I would write it in Rust if I wanted to keep it simple.
However simple =/= fast

I have some idea for optimized, C-like solution, but I don't have time to write it down right now.
The basic idea is to split this into 3 cases: (1)len < 64, (2)64 <= len < 128, (3) 128 <= len
(1) you can do preliminary filtering using POPCNT+TZCNT as a bucket has to have at least len bits(set/unset) or ends up with some bits to be any interest for you.
(2) you can just use TZCNT+LZCNT because the sequence is guaranteed to span at least 2 buckets.
(3) you can do preliminary filtering by checking bucket = 0/~0 because the sequence is guaranteed to span at least one homogeneous bucket in it. Then just check proceeding and following buckets in using TZCNT/LZCNT
Only in (1) you need explicit looping over each bit. It might turn out to be more performant if you split them in u32s or u16s.
If this is performance critical code, I strongly suggest you set up some benchmark and observe emitted assembly to find best solution.
>>
>>107113592
btw I made it return the position of last bit of matching sequence, but one can just (pos + 1 - len) to find the start of it.
>>
>>107113592
Also (2) and (3) can probably be combined if checking for bucket == 0 is not much faster than TZCNT
>>
>>107113513
>>107113592
what is it that youre trying to do?
you look for the first 0 or the first 1, and what next?
you emit its position?
whats the actual mission bc finding the first 0 or the first 1 isnt that complicated
but you still return u32_max
i dont get it
>>
>>107113513
>>107113633
cont
>if (run >= num_bits) return (bk * 64 + bit) - run;

aaaah
so you return the position of the first 0 or 1 found in an array
ok
gimme a sec
>>
>>107113633
He is looking for first span of continuous bits(either 1s or 0s based on template argument) of given length inside some arbitrary long bitfield stored as an array of u64s
>>
>>107113592
Naive is 4.3x slower, trying your optimized approach now.
>>
>>107113687
aaaaah
much more interesting
ok
>>
>>107113571
They seem attracted to photocopiers, so wear clothing reminiscent of a photocopier
>>
File: Gu9sZNwWUAABsbu.jpg (40 KB, 735x640)
40 KB
40 KB JPG
>>107113486
That would be Clojure
>>
>>107113418
I need a shy pervert office lady GF like this.
>>
>>107113820
>Tensei Shitara Fukushaki Datta Ken
>>
I just learned that cniles don't have booleans in their language
>>
File: enlightenment.png (38 KB, 1024x1024)
38 KB
38 KB PNG
>>107115077
That's a funny way of spelling Common Lisp
>>
File: 1759701366685367.gif (53 KB, 300x300)
53 KB
53 KB GIF
>>107115761
Not true since c23, we even have static_assert and nullptr now
>>
>>107113513
Yes, there is a neat bit trick. I even posted it here this year or the last. I'm trying to find it in the archive.
>>
>>107115165
I wish this was real. Another strategy is leaving a trail of stationary, coffee vouchers, and various luxury products leading to the cafeteria to lure OLs to lunch
>>
File: uni-mc-wagie.jpg (7 KB, 217x232)
7 KB
7 KB JPG
>>107115761
>needs a dedicated boolean type
the absolute state
also
>>107115951
how does that stack up with branchless?
does it throw an error? lmao
>>
>>107115761
I present to you the octolean, a vastly superior boolean.
>>
>>107115761
stdbool is c99 i think?
>>
>>107116141
hexafoureans are so much better
>>
>>107116325
I'm a catastrophe.
>>107113513
>>107115972
This finds sequences where there are 3 or more consecutive 1 bits.
It's very simple. There is a bit sequence of 1s of length >= 3 starting at bit n if bit(n) == 1 && bit(n + 1) == 1 && bit(n + 2) == 1.
From there, if locations is not 0 you can easily find n by counting the number of leading 0s.
uint32_t bitmap = 0b011110111011010;
uint32_t x = bitmap;
uint32_t locations = x & x >> 1 & x >> 2;

if (locations == 0) {
// no sequence of bits is long enough
}
else {
printf("bitmap 0b%032b\n", bitmap);
printf("locations 0b%032b\n", locations);
}

bitmap    0b00000000000000000011110111011010
locations 0b00000000000000000000110001000000
>>
>>107115761
>cniles == nazis
>>
>>107113418
Why is she watching pornography at work?
>>
>>107116521
looks more like online lingerie shopping

>>107116126
>>needs a dedicated boolean type
better than having any type also act as a boolean as long as it's "zero"
>>
>>107116714
>better than having any type also act as a boolean as long as it's "zero"
i really dont see how
0 as false and anything but zero being true is comfy
>>
>>107116714
if (timer)
{
timer--;
}
>>
>>107116751
>0 as false and anything but zero being true is comfy
It's comfy but wrong, the compiler should be smart to see
enun state { stop, go }
and not permit
enum state s = 3
, as it raises the question of which of these are exhaustive:
switch (s) {
case stop:
....
case go:
....
case default:
....
}

switch (s) {
case stop:
....
case go:
....
}
>>
>>107116950
nono
it is correct
whats incorrect is your mental model of the language
how can a language be incorrect?
>>
>>107116782
timer = -1;

oops, timer broke
>>
>>107116950
>and not permit
its useful though
>>
>>107117003
>non exhaustive switch statements should not be permitted
what if one doesnt want anything to happen?
hes an autist
he cant wrap his head around any amount of fuzziness
>>
File: 1758373800279140.jpg (42 KB, 350x490)
42 KB
42 KB JPG
>>107117029
There's enough undefined behavior already without adding to it
>>
File: w11-devs.png (413 KB, 546x502)
413 KB
413 KB PNG
>>107117042
ub only means implementation defined
youre amgery at this because turns out not everything is contained within the standard

yes you have to learn more shit including learning empirically
no, the underlying mechanisms dont all neatly align its actually a big fucking mess of various, sometimes overlapping responsibilities
nor will the universe cater to your irrational need for order
>>
>>107117042
static casting something to and from the underlying type is well defined
>>
>>107117120
yea it all dissolves into syntactic sugar
an enum is an int iirc
>>
>>107117079
Hopefully the outcome of evaluating an expression like `true && false' isn't a matter of empirical observation but logical deduction, or we can at least arrange the machinery so we can imagine it is so
>>
>>107116126
>how does that stack up with branchless?
all a boolean type is doing is expressing that there's only one bit of meaningful information in that variable
it doesn't say at all whether operations require branches or not because that depends on so many other factors (including whether you bother to enable the optimizer lol)
>>
>>107117079
>ub only means implementation defined
sometimes not even that; blowing off the end of an array on the stack can easily get into total "fuck the rules" land
>>
>>107116950
If you want that level of guarantee, write Java or Rust.
>>
>>107117191
NTA but what is the "correct" way to tell the compiler I want strictness and not lazy/short circuiting &&
Is it just to use & even for logical ops?
>>
>>107117183
the observable, measurable effect on reality is how the machine performs.
the language is perfectly abstract.

empirical observation intervenes when one compares the language input to the asm output and then how the latter performs on an actual machine
theres two degrees of abstraction before we get to the observable effect
which is the goal of the exercice here-
what matters is not the purity of code, but how the machine performs
regardless of the lang, ub or not
again, your ubs are perfectly deterministic, even implementation defined in some cases
>>
>>107116950
correct
>>107117003
idiot
>>
>>107117213
thats on the compiler
if the cpu gets the directive to go to address x
then short of tripping some hardware protection its what its gonna do
its deterministic.
which makes it implementation if we stretch the definition a little bit

>>107117191
no, i meant something like this:
mask = TRUE * 1 + TRUE * 2 + FALSE * 4 + TRUE * 8;

liek int the conetxt of branchless maths and truth tables
>>
>>107117182
depends on the lang. c++ you can specify it, by default it's an int, but there's also some wacky rule (I think only applying to enum class) about the underlying type being "the minimum bitfield size to hold all enum values" which makes any swich case on a 2^n enum without default defined but any other type of enum UB (though most compilers lie and tell you it's fine...)
>>
>>107117303
>something like this
its contrived asf in my actual code you'd see something like this:
jump_table[(is_alpha) + (is_wspace * 2)];

if its enforced as type different from ints then that doesnt work
>>
>>107117336
>(though most compilers lie and tell you it's fine...)
they dont really lie i think theres a flag you can activate to find ub
i vaguely remember something like that for c
and heres the thing: a construct may be supported by the compiler while also being ub in the standard
type punning through union is apparently ub in sepples.
but its supported by most compilers from what i read (btw, wtf? why would you want to ub type punning through an union?)
>>
>>107117346
>if its enforced as type different from ints then that doesnt work
that's why type should have an abstract algebraic data type definition for type safety and generiticty, and optionally have a concrete implementation that allows you to write efficient code

this is a continuation of the idea of functions making operations on an abstract data structure (it calls methods on an abstract class) and then you can use different class implementations without changing the functions that use it
>>
>>107117395
I think I had it backwards, if you enable all the error checking flags it will complain to you about something like the following despite this case being explicitly defined for 2^n non-fixed enums

enum class Alpha {
A,
B
};

int printer(Alpha alpha) {
switch(alpha) {
case Alpha::A: return 1;
case Alpha::B: return 2;
}
}
>>
>>107113486
Based.
>>
>>107117526
yeah thats for higher level languages than c
the usecase for c is hacky shit, safety and genericity are the least of ones concerns
whats most important is consistent internal representations and kinda the opposite of safety, type flexibility
>>
>>107117567
maybe its a standard thing
as in your compiler compiles with a default standard but it becomes defined in a later one, still available, but as opt in
idk, i dont program in sepples
its an entirely different beast from c
but yeah, there is indeed a class of constructs that are ub in the standard but supported by the compilers, individually
>>
You CANNOT escape us.
You WILL be functional.
https://www.open-std.org/JTC1/SC22/WG14/www/docs/n3694.htm
>>
>>107117677
>https://www.open-std.org/JTC1/SC22/WG14/www/docs/n3694.htm
wow
so were gonna get this mental retardation and force inlines are not yet standard?
>>
>>107117677
>>107117698
cont
its still only a proposal hopefully it gets rejected
>>
>>107117000
*void

oops, code broke
>>
>>107117802
ez fix: dont run with scissors
>>
>>107117815
Like setting a timer to -1?
>>
>>107117832
depends whether thats what youre looking for
you could be using -1 as an error
read() does it. open() does it...
>>
>>107117849
That's the point though an int is superior to an boolean.
>>
>>107117880
yes it is, never implied the contrary
>>
from one retardation to another

>>107117849
mixing error codes with actual values is an even worse practice
>>
File: best-i-C-an-do.png (245 KB, 500x493)
245 KB
245 KB PNG
>>107118019
then dont use c?
if you need a child proofed language youre prolly not gonna take advantage c anyways
>>
File: 1749846737411421.jpg (300 KB, 1920x1080)
300 KB
300 KB JPG
Graphics APIs got so much bullshit its making buying a 'eck to fuck around with bare metal GPU programming look attractive
>>
>>107118092
>if you need a child proofed language
ironic statement given C is mostly used by students and unemployed hobbyists
>>
File: C-aliens.png (136 KB, 640x463)
136 KB
136 KB PNG
>>107118225
also aerospace and medical equipment producers
that you get filtered is a (you) issue
>>
File: Figure_1.png (301 KB, 1500x900)
301 KB
301 KB PNG
>>107113727
Have you managed to do it?

I repurposed my old benchmark and set it up for this problem. I will try implementing and testing some of these tomorrow.
>>
>>107113418
C# incremental source generator that generates models, services, and API controllers from attributes on EF Core entities.
>>
>>107118455
Nah, too many edge cases with boundaries and holes.
>>
>>107118688
>too many edge cases
There isn't any really.
>>
>>107115139
The coloring on her tights make it look like a mannequin underneath
>>
>>107113418
Doki-chan is so beautiful.

Anyway, I am doing backlogged Advent of Codes. 15 Day 7 is royal fucking bullshit.
>>
>>107113571
Be White.
>>
what can i code solo that will definitely make me at least $1000/month profit if i market it correctly and try long enough?
>>
guys look what i made. does it have any monetization potential? (even $100/month from patreon or something, i'm not trying to become rich just not starve)
https://schizodot.wtf
>>
>>107119199
SaaS is dead. It's all AI now.
>>
>>107119221
what about single product ecommerce site then run social ads on it? seems like low hanging fruit for a programmer
>>
>>107119199
personally i wish there was an app that forced me to vest my money for at least 1 year, to stop me from spending it due to lack of self control if i can just take it out any time. it puts the money in S&P 500 for me and if i choose a vestment of 1 year if will drip feed me 1/52th (52 weeks in a year) of my money back per week. am i really the only person who needs an app like this? think about it, if it forces you to vest the money and it gives you the +10-15% appreciation per year, and you keep putting like half your paycheck into it every time you get paid -instead- of putting it in a savings account, in no time the amount it drips back to you every week will be enough to live off of. it gives me a feeling of security.

example:
>you make $2000/week but can frugally live off $1000/week so you put $1000/week into vestment, which will drip you back $20/week, or 1% of your typical paycheck or 2% of half your paycheck which you kept.
>after 12 weeks you're getting dripped back $240/week. add that to the $1000 of your paycheck you keep and you have $1240, it's like getting a 2% raise every week, feels like progress.
>after 52 weeks you've hit equilibrium, $1000/week is dripping back to you. now if you wanted to from there you can choose longer vestment periods like 2 or even 3 years and now the amount dripping back to you actually EXCEEDS the amount of your full paycheck if you had never vested any at all
anyone seeing what i'm saying here? it's a forced delayed gratification app.
>>
>>107119294
Mark Bussler from Classic Game Room is a creator that I really enjoy from way back in the day. He's expressed a lot of discontent with the current state of things, and he said in a podcast, his words, not mine: "The only way left to make money anymore is to make physical, tangible goods and selling them online".

So yes, sell something online with a site, but the software itself is a solved problem and has been for aeons upon aeons upon aeons. You can use Wix, or Shopify, or stand something up yourself (but why though?); actually focus on the product to sell, and it has to be something tangible and physical and that people actually want to buy.

But making money off of the software only is just a flat out no. It's a way too oversaturated market, even more with the AI being around.
>>
>>107118705
She's wearing stockings.
>>
>>107119804
Pantyhose, but I get what you were going for

t. Doki-chan adorer
>>
cool website
https://www.memorymanagement.org
>>
File: 1620959278062.jpg (9 KB, 229x220)
9 KB
9 KB JPG
>>107118340
you won't find such engineers defending C as a language
>>
>>107115913
John McCarthy's LISP
>>
File: laughing_caprio_jesus.png (266 KB, 400x400)
266 KB
266 KB PNG
>>107120447
>doesnt know rtos'es get written in c
>pretends to be an authority on the subject
why people who attack c always turn out to be retarded?
>>
>>107121542
>>doesnt know rtos'es get written in c
find an engineer that wrote a RTOS that defends C as a language
>>pretends to be an authority on the subject
projection, especially with all these "google tell me what epic things are written in c" "arguments"
>>
>>107121542
NTA
You can write RTOS in any system programming language. They usually get written in mix of C and asm. However things like embassy do everything RTOS typically do but faster, with less overhead and actually nicely integrate with language features so RTOSes might eventually die along with C.
>>
>>107121984
>You can use any language, ok? That's why everyone always chooses just one.
>>
>>107122301
Who are you quoting?
>>
>>107122327
A hypothetical scientific paper written by a retard who unfortunately has 0 experience writing RTOS in any non-C language OR writing any scientific papers.
Feel free to post them so I can quite your retardation directly this time.
>>
>>107122337
No idea what you are schizo babbling about. I just entered this thread and explained to you why no one makes RTOSes in other languages.
I will paraphrase it for you. RTOSes are made in C because it is a stop gap solution. Other languages have async semantics and can accomplish everything a RTOS do faster and with less overhead.
>>
>>107113820
this. girlies at my job love when I go fix their bratty little printers.
>>
>>107122359
>async semantics
Example?
>>
>>107122367
I already told you, for example: embassy.
https://embassy.dev/
https://tweedegolf.nl/en/blog/65/async-rust-vs-rtos-showdown
>>
I made my code 3 times faster!
>>
I have a good computer but CLion is still laggy. Do I actually have to switch to vim or what? I don't wanna.
>>
>>107122375
By example, I meant real life usecase.
>>
>>107122587
I literally just told you. It's the same usecase as RTOS. Are you retarded?
>>
>>107122602
No, it isn't, show me actual real life usecases.
>>
>>107122359
Async semantics are irrelevant. You still need to make the scheduler yourself. Congrats, you're still writing an RTOS!
>>
>>107122605
>No, it isn't
[citation needed]
>>
>>107122623
Async semantics is what enables you to implement something like embassy(scheduler) that closely integrates with language features(async) without having to write entire typical RTOS which in practice is slower and much much heavier.
For example when I ditched RTOS(FreeRTOS) for embassy, the size of my binary decreased 14 times.
>>
>>107122660
>language features
Rust async isn't a language feature, and on top of that, it's total slop, there's literally not a single thing about it that's good or useful to anyone.
>>107122624
Real life usecase would be useful implementation that benefits humanity,
>>
File: 1409901609892.jpg (43 KB, 372x372)
43 KB
43 KB JPG
>>107122748
>Rust async isn't a language feature
>>
>>107122764
Show me rust async implementation in the compiler.
>>
Full disclosure: Me = /g/ tourist

I'm also not a programmer, but this particular code seemed (at first) simple enough to affect with only a cursory understanding It wasn't (or im even dumber than I think I am.)

I'm trying to make this shader JUST flat colors and to remove all gradient lighting effects, but this code seems to have been written differently from anything I saw trying to learn this process in OpenGL. Im pretty sure its OpenGL code. I don't even know if that makes sense. Anyway, heres the code. It's from the EasyFPS program.

Ive got about 40 bucks I can spend on this, but Anonymous message board. If anyone is interested, I'm sure we could work something out.

Thanks.
>>
>>107122660
>without having to write entire typical RTOS
You still have to do this.
>Async semantics is what enables you to implement something like embassy(scheduler) that closely integrates with language features
All async semantics do is move what is normally a function invocation into the grammar. That's it. If you think thread management was the hard part of writing bare metal C code, I don't know what to tell you anon except that I think you should spend more time doing things rather than reading about them.
>>
>>107122838


The file
>>
>>107122788
https://github.com/search?q=repo%3Arust-lang%2Frust+path%3Acompiler+async&type=code&p=1
https://rustc-dev-guide.rust-lang.org/coroutine-closures.html
>>
>>107122847
>You still have to do this.
Only the scheduler part. Tasks composition and handling is done by the language.
I am not claiming that async is fundamentally different solution. I am only saying that async allows you to archive better speed and binary size than using typical RTOS.

>All async semantics do is move what is normally a function invocation into the grammar. That's it.
And that's precisely what makes all the difference.

>If you think thread management was the hard part of writing bare metal C code
I never said so. I only said that typical RTOS is slower and heavier.

>I think you should spend more time doing things rather than reading about them.
I have been regularly posting progress of my embedded project for like 3 months on /dpt/
>>
File: torvalds.jpg (24 KB, 487x362)
24 KB
24 KB JPG
>>107121919
>find an engineer that wrote a RTOS that defends C as a language
nah rather ill let you prove that all of them are against the use of c ;)

>>107121984
>embussy
>how to tell someone you dont know what is the actual defining feature of an rtos without actually saying it (its determinism/predicatibility btw)

the absolute state
>>
>>107123089
Embassy is just as predictable and deterministic as your typical RTOS. You can configure it to do pretty much same thing.
>>
>cnile has to pivot into hyper-theroetical discussion about RTOSes because he can't counter-argue about mixing values and return codes being a shit practice
lmao
>>
File: gun.gif (916 KB, 220x157)
916 KB
916 KB GIF
>>107123108
so is it the same, or is it pretty much the same?
post benchmarks because the whole async/await idea is completely fucktarded in the context of an rtos
im really curious to see how this stacks up
>>
>>107123142
>post benchmarks
>>107122375
>https://tweedegolf.nl/en/blog/65/async-rust-vs-rtos-showdown
>>
>>107123151
im currently reading it
not a word about repeatability
>>
>>107123160
Brooo, it's faster in a benchmark that does nothing, is that not good enough?
>>
>>107122855
>The file
Where is it?
>>
>>107123202
theres alot of ways thats not good enough
not only theres a plethora of rtoses on the market
but the more i read into how the benchmark was made the less i like it
for instance:
>To determine if the button is pressed, we have an atomic bool that we need to read
then the test resolution for responsiveness is limited to the space bw two iterations
and since its an atomic bool, it can sit behind a lock
two ways that can fuck with repeatability in a major way
>but speed
speed doesnt matter as much, also speed how?
speed in short latencies, or speed in troughput?
>>
File: Screenshot.png (237 KB, 1195x612)
237 KB
237 KB PNG
>>
>>107123500
its always the illiterates...
>>
>>107123500
...and other low iq rabble who should have known better
---
os scheduled delays are notorious for their unpredictability
>>
>>107123519
?
>>
>>107123564
>os scheduled delays are notorious for their unpredictability
So RTOS is not so predictable then.
>>
File: heavy-metal.jpg (37 KB, 540x718)
37 KB
37 KB JPG
>>107123594
no, you use other solutions instead.
the whole thing about os scheduled waits is that the os frees up the core your code was running in.
when your process resumes, the core is reallocated to your process
all that takes non-deterministic amounts of time, and thats why os scheduled waits are notoriously, or even inherently unpredictable
>>
funny how every time c is assailed, the discussion turns into a cs 101 lesson
this can go both ways but usually its the c-ultists who provide the knowledge
>>
>>107123941
>its the c-ultists who provide the knowledge
But it's the C programmer who didn't knew that async is a language feature, didn't knew about embedded async schedulers and didn't knew the usacase for embassy. He had to be spoon fed all that information. >>107122367 >>107122587 >>107122788
And despite being proven wrong multiple times, he keeps moving the goal post every single time.
>>
>>107123830
>all that takes non-deterministic amounts of time,
So much for predictability.
>>
File: yotsuba-hell.gif (446 KB, 480x340)
446 KB
446 KB GIF
>>107123999
...with that design pattern.
you poll a variable in a loop and your predictability is back
its so annoying to talk with autists like you
everything has to go slow, and beyond methodical

>>107123992
>others suck therefore you do too
thats not logical. also i thing it has been mentioned that c is not only a high performance language, but also a didactic tool
and now imagine some anons are filtered by it.
a didactic tool. crazy, init()?
>>
>>107124028
>others suck therefore you do too
I haven't said anything about you, only about that anon who had to be taught all these things despite you claiming otherwise.
Or are you just samefagging as both the uneducated anon and anon who seemingly just entered this thread and made a backwards observation?
>>
File: tinfoil-mrna.jpg (181 KB, 944x1024)
181 KB
181 KB JPG
>>107123999
>...with that design pattern.
i see your anal autism coming from a mile away
to be exactly precise:
you increase the frequency of your polling to reduce the possible uncertainty down to the incrementation of a register and a load, and a predictable conditional jump
here, u happy?
>>
File: supersayanim.png (235 KB, 800x764)
235 KB
235 KB PNG
>>107124080
then why do you bring up a sample size of 1?
even if i were solipsistic about things
i have a ratio of about 300 : 1 interactions with people who assail c
where 300 times i end up teaching them, like a fucking teacher jany because unpaid labor, like fukken modern slavery, helloooo
for 1 time where i learn something
and this interaction counts as me learning something because you forced me to look into rtoses with the slightest modicum of trace seriousness
>>
>give me an example
>*example*
>no, I didn't mean an example, I meant usecase
>*usecase*
>no, I didn't mean usecase, I meant a "useful implementation that benefits humanity". Also async is not implemented in compiler
>*part of compiler that implements async*
>But at least it's slower, give be a benchmark
>*benchmark*
>no, I didn't mean a benchmark, I meant a test for vaguely defined "predictability"
>*predictability of sleep*
>no, not this part of predictability. Also I am always right
>*all the times you were wrong*
>it doesn't count! *ad hominem* x10
>>
>start using watchexec to auto compile and run my gaycode problems
>at some point whole pc freezes
>says my terminal is taking up 32gb of RAM
>ask chatgpt whats the problem
>find out it's because I set the scrollback lines max value to 10 billion in my terminal
>>
File: crab-roast.jpg (86 KB, 683x459)
86 KB
86 KB JPG
>>107124190
even brave gpt says youre retarded
i think its THE signal to question your life choices...
>>
File: rustranny.jpg (387 KB, 760x704)
387 KB
387 KB JPG
>everyone who disagrees with me is one person-ACK!
>>
File: dancing-ferris.gif (258 KB, 734x490)
258 KB
258 KB GIF
>*ad hominem*
>*ad hominem*
>*ad hominem*
It's all they have left
>>
File: 00s.jpg (160 KB, 500x333)
160 KB
160 KB JPG
>troon melty? but we didn't order any glowniggers to cause one today
>>
File: recycle-rust.png (351 KB, 600x600)
351 KB
351 KB PNG
>>107124272
then why did you even begin with posting?
bc its all you got. sad homonems
>>
File: 1565141802129.gif (605 KB, 540x540)
605 KB
605 KB GIF
>*ad hominem*
>*ad hominem*
>*ad hominem*
>>
>>107124307
Why is that animation so janky? Crabs don't take that long to wind up and begin running, I guess animator had to match speed of Rust.
>>
>>107124307
>how to become a thread's chewtoy in one post
>>
>>107124289
this is thoroughly disgusting.
delet this
>>
>>107124289
>>107124352
actually dont
but i want it to be archived that i find this sight utterly deranging
>>
>>107124216
>>even brave gpt says youre retarded
>using GPT to do your thinking for you
>posts retarded meme format of a cop pointing a gun at someone who was literally killing themself with self immolation.
are Cniles in cognizant of how retarded their own posts make them appear?
>>
>>107124364
>>using GPT to do your thinking for you
i said pretty much the opposite
imagine being such a fucktard that even the lowest tier of chatbot dunks on you
this is what i meant
again
autismo retards need me to slow the fuck down to an unbearable level

ur dumb, nigger
shut the fuck up
>>
>>107124381
>>i said pretty much the opposite
>mentions using gAI at all
you're retarded and brown.
>>
>>107124390
1000 iq response, everyone clap
---
ur finished?
can we go back to anything thats not you seething about the fact youre filtered by C?
>>
>rust shill calling anyone but himself brown
You know that rust was created because indians keep causing over 70% of vulnerabilities by constantly corrupting memory, right?
>>
>>107124407
ok. I read up. You're retarded. what more do you want me to say?
If your hardware needs require a semblance of determinism, your code looks like a tight loop. if you don't care, you either use an RTOS, async/await shit or whatever.
what do you want to discuss?
>>
>>107124436
>n-no, u
ok, youre trolling now
>>
>>107124448
so you don't want to discuss anything? ok, so you're just another LLM brain damaged /g/eet who should fuck off from this thread.
>>
>>107124461
>so you don't want to discuss anything?
not anymore. not with you.
>>
>>107124471
kek wtf?
LLM brain damage.
maybe jannies should ban me for racism again. was better for my mental health.
>>
>>107124477
>but i wanna flame you
what if *I* dont wanna?
>>
>open /g/
>"even brave gpt says youre retarded"
Until next time guys
>>
>>107124504
This isn't the daily retard thread
>>
>>107124504
>implying /g/entoomen care about the opinion of others
this would have been a macfag forum then
not- literally every os under the sun- forum.
some of us wrote their own
>>
on behalf of all poltards who become c-ultists by proxy
and all the c-ultists who have too much fire in their blood
i say:
I am truly sorry.

but all of us combined dont make as much a nuisance as the fukken reddit people who push a language because its a cause or something
maybe the crab community should FINALLY *fukken* fix their drones when they go off script
>>
ITT two niggas competing for the most unemployed award
>>
File: ack.jpg (511 KB, 1588x1138)
511 KB
511 KB JPG
It's funny to be a C++ user who reads two retards shit fling at eachother while their languages somehow have only worst parts of C++ and none of the good stuff.
>>
File: shartyposter-kids.webm (2.06 MB, 480x854)
2.06 MB
2.06 MB WEBM
>>107124575
>t. soiPEDO who cant be arsed to follow more than two replies
youre just another brand of cancer
>>
>>107124364
It seems they lack mental capacity for higher order thinking like this.
It was funny ngl. I'm really glad I don't have to rely on an AI algorithm to tell me what to think about people I converse with. But now it's time to get back to programming.
>>
>>107124600
>stat inference is not stat inference
ur a samefag, arent you?
its rare that two sub 80 iqs end up in the same threaéd
>>
>>107124418
I'm not that anon. I am the anon who tried to have normal discussion about embedded systems. I think I made my point and further discussion will be fruitless. I gave up at >>107124190 and it's some random anon who continues this pointless meritless argument.
>>
File: doom-C-layer.png (1.29 MB, 1280x720)
1.29 MB
1.29 MB PNG
>>107124648
>the rust community
maybe you should do some self policing like we do
bc the other anon is unironically making a joke out of rust
>>
>enter programming thread
>the 3 resident Rust trannies are spamming it
If Rust was winning the propaganda wouldn't be necessary.
>>
File: black-square.png (983 B, 400x400)
983 B
983 B PNG
>>107124648
>>107124658
cont
but you tolerated the slip
and i had to point that out
its the difference bw our communities

you will pull the alarm cord only when some retard nigger is discrediting you

we reject whoever says wrong, and doesnt repent

your community is shit
rust is shit
youre worthless people
you will always remain that way
your code is worthless
your posturing is worthless
because you accept filth
and you reject it only when it affecrts you

the c community rejects you whenever youre impure
big fucking difference
and the main reason why EVERYTHING rust is to be considered GARBAGE. just full stop.
irredeemable fucking leaking fucking garbage

----> because you just dont care as long as it doesnt affect you, personally

fuck rust
fuck even fighting over low level

you will self fucking destruct
>>
File: 1712393062225143.jpg (29 KB, 542x542)
29 KB
29 KB JPG
I've forgotten everything since starting my masters. I mostly rely on chatgpt now, but it's gotten embarrassing.

What's a good way to get back into things?
>>
File: clown-b.jpg (75 KB, 680x480)
75 KB
75 KB JPG
>>107124722
download mans so you can find everything back
>>
>>107124722
>>107124736
cont
also:
mechanical memory is your friend.
and keep old versions somewhere
so that when you dont remeber how to do something you chech your source code
>>
File: sudo-gondola.png (203 KB, 1370x1530)
203 KB
203 KB PNG
>>107124648
>>107124709
to drive the point home:
THE COMPUTER DOESNT GIVE A SHIT ABOUT UR PRONOUNS, RETARD NIGGER GORILLA
>>
>>107123108
the problem with embassy is that async logic does not work in webassembly.
And I would assume that no rust wasm runtime can fit under 500kb, unlike wamr.
And I would be worried about the size of a rust binary using something simple like print formatting or a vec (same problem that C has, C will explode into a 500kb wasm blob if you dare use malloc or printf, when it could easily fit in a few kb if you replaced printf/malloc/string.h with a mini implementation).
I would use webassembly because you can log your stacktraces onto the sd card or whatever, because there is a good chance that the usecase of the device cannot be connected to GDB/whatever while in a real world scenario, and you cannot recreate the real world scenario beside connected to GDB (and of course, to get good stack traces, you need to reduce inlining, and I have heard you could make a wasm coredump, not a WAMR thing, I think rust wasm runtimes might support it? but that would need debug-info which will 20x the size and you need a special debugger, at that point just give me a $10 arm CPU with linux and address sanitizer and connect GDB wirelessly).
But I just larp for embedded dev, I would not be surprised if you physically cannot do a lot with wasm on a multi-thread / rtos system.
>>
File: chud-wesker.png (175 KB, 446x602)
175 KB
175 KB PNG
>inb4 muh whatever
if you NEED the features of rust
youre either:
a jeetnigger
an intern
a fucking autist
thats it

whats the fucking problem with actually conceptualiszing ones algos?
>muh loonis cant get it right
THEN THEYRE FUCKING INFERIOR AND THEY SHOULDNT WRITE IN C

>YEAH BUT WHO ELSE IS GONNA DO DAT
and that is the crux of the issue
who else are gonna maintain open sauce than people who cant create a monetizable product...
>>
File: kottest-kot.jpg (54 KB, 1125x1125)
54 KB
54 KB JPG
loonis went with c bc its the least bad choice when considering the alternatives.
im unironically welcome to challenges, i more or less master c and i have a firm grap on its extensions, but im not yet an osdev
>>
File: soulless-pepe-round.jpg (73 KB, 962x962)
73 KB
73 KB JPG
all that to say:
dont badmoyuth c unless youre really sure about yourself.
bc theres 300 to 1 im gonna rape your mental model of programming
and im gonna make you watch
>>
File: g-carlos.jpg (54 KB, 600x600)
54 KB
54 KB JPG
why low iq retards want to confront, bros?
thats hwat i thought until i remmebered that ones value is the limits of ones knowledge
which then makes perfect sense to test ones limits
which i do all the time
but why do you crabs fail though

id love to have you to distill my viewvs
but youre fucking dumb
>>
File: reacemix.png (287 KB, 550x309)
287 KB
287 KB PNG
and inferior
why cant you be superior?
bein superior is how youre interesting....
but youre retarded by all metrics

do better, fukken autists
>>
>>107124944
Wait, where does the wasm come in? Embassy is a runtime for embedded devices, not wasm. I haven't done any async in wasm, but it seems there are solutions like wasm-bindgen-futures that let you use browser event loop as your executor.

>And I would be worried about the size of a rust binary using something simple like print formatting or a vec
That's a valid concern. A normal rust formatting can be unnecessarily slow for embedded, especially for low importance things like logging. That's why there are solutions like defmt which integrate with your runner/probe via some compile-time magic and special symbols to allow for much more efficient and alloc-free logging. It basically sends all parameters via serial and "defers" formatting to host/computer side. https://defmt.ferrous-systems.com/

>there is a good chance that the usecase of the device cannot be connected to GDB/whatever while in a real world scenario
I just use JTAG-USB and it supports debugging.
>>
File: tlj.jpg (16 KB, 320x160)
16 KB
16 KB JPG
>>107125440
>wasm
>mfw in the context of rtos
>>
File: 1695401611957318.jpg (130 KB, 680x760)
130 KB
130 KB JPG
>>107125440
>>107125456
cont
i think that was just a medley of w3 buzzwords
a fkn buzzword salad
a lil bit of this
a lil bit of that...
bc it makes 0 logical fukken sense
>>
File: normal-g-y.jpg (3.21 MB, 1280x9524)
3.21 MB
3.21 MB JPG
cont.
this makes as much sense as fukken rust for gpus
>inb4
i know exactly what im expecting
x3 faster than a cpu when a gpu is more than x20 faster
>>
>>107113418
I need a petite office lady like that in my life.
>>
>>107125519
ez fix
just reject evrything thats > 170 cm high
>>
>>107125533
>NaN
>>
>>107125519
>>107125533
cont
tiny women are best women
>inb4 pedos
im you but bettr
you can only spawncamp
>>
>>107125540
iva been with a tiny woman
not dwarfism
but still fukken tiny

best sex in my life
also she was barren, could have kept her the sex was reaaaaaaaaaly nice
>>
>>107125540
>>107125568
she was 23
another layer of despisal i have towards pedos:
they didnt even try
fuken
theyre dysfunctional we should kill em now that natural selection is ded
esp. tiny women are a thing
>>
>yea no i have a tiny pecker
not an excuse
let me introduce you to my elbow
>>
>>107115913
actually it's https://lfe.io/
>>
>>107113513
>>107118698
Here it is, now it's 10-100x faster.
Also uses >>107116367 idea for counting runs under 64.
Thank you anons.

static constexpr inline u32 idx(u32 bucket, u32 bit) {
return bucket * 64 + bit;
}
template <bool BIT>
static constexpr u32 find_sequence(u64 *buckets, u32 num_buckets, u32 num_bits) {
if (num_bits < 64) {
for (u32 bk = 0; bk < num_buckets - 1; ++bk) {
const auto left = BIT ? buckets[bk] : ~buckets[bk];
if (popcnt(left) >= num_bits) {
u64 runs = left;
for (u32 sh = 1; sh < num_bits; ++sh) runs &= left >> sh;
if (runs) {
const auto bit = tzcnt(runs);
return idx(bk, bit);
}
}
const auto right = BIT ? ~buckets[bk + 1] : buckets[bk + 1];
const auto ones_left = lzcnt(~left);
const auto ones_right = tzcnt(right);
if (ones_left + ones_right >= num_bits) return idx(bk, 64 - ones_left);
}
const auto bk = num_buckets - 1;
const auto last = BIT ? buckets[bk] : ~buckets[bk];
if (popcnt(last) >= num_bits) {
u64 runs = last;
for (u32 sh = 1; sh < num_bits; ++sh) runs &= last >> sh;
if (runs) {
const auto bit = tzcnt(runs);
return idx(bk, bit);
}
}
} else if (num_bits < 128) {
for (u32 bk = 0; bk < num_buckets - 1; ++bk) {
const auto left = BIT ? ~buckets[bk] : buckets[bk];
const auto right = BIT ? ~buckets[bk + 1] : buckets[bk + 1];
const auto ones_left = lzcnt(left);
const auto ones_right = tzcnt(right);
if (ones_left + ones_right >= num_bits) return idx(bk, 64 - ones_left);
}
} else {
CHARACTER LIMIT
>>
>>107125656
    const auto min_full = i32(num_bits) / 64 - 1;
u32 num_full = 0;
for (i32 bk = 0; bk < num_buckets; ++bk) {
constexpr auto FULL = BIT ? U64_MAX : 0;
if (buckets[bk] == FULL) ++num_full;
else num_full = 0;
if (num_full == min_full) {
u32 ones_left = 0;
const auto bk_l = bk - min_full;
if (bk_l >= 0) {
const auto left = BIT ? ~buckets[bk_l] : buckets[bk_l];
ones_left = lzcnt(left);
}
u32 ones_right = 0;
for (++bk; bk < num_buckets; ++bk) {
const auto right = BIT ? ~buckets[bk] : buckets[bk];
ones_right += tzcnt(right);
if (right != FULL) break;
}
if (min_full * 64 + ones_left + ones_right >= num_bits) return idx(bk_l, 64 - ones_left);
}
}
}
return U32_MAX;
}
>>
>>107125656
hae you tried parsing your string with intrinsics, doe?
you can parse 32 bytes at a time for empty/filled situations
yorure alrdy doing em
tscnt is a compiler intrinsic.
>>
>>107125674
>tscnt
*tzcnt
also lzcnt is a thing...
>>
>>107125656
>>107125674
actually
im following your thread since yesterday
and you could do lzcnts to get through the whole 64 bits at once if apploicable
i didnt post my solution bc i have more condoitionjals than you
and our conditionals is what is taking the most time
but its an alternative:
LZCNT.
counts leading zeros
leading zeros make a shift
shift your target
reverese it
and run lzcnt again
now you have: offset
and
bitsize count
its an angle...
theres the conditionals, those fucked me over then i went "actually fuck it"
but its an alternative take
>>
>>107125656
>>107125666
Nice! I'm going to plug this into my benchmark so we get nice plots. I'm going to add an additional subplot for medians for more readable variant, and cpu pinning and real time scheduling to minimize noise from the OS.
Also I think you can do it even faster for small lengths using divide and conquer approach. Think of this like fast exponentiation algorithm. For example to find runs of length 8, you can just do:
temp = buf & buf >> 1
temp = temp & temp >> 2
out = temp & temp >> 4
3 shifts and 3 ands instead of 7 of each.
>>
>thread
*topic.
close enough lamao
>>
>>107113418
Trying to modify the python exception handling to automatically fix errors and continue execution
>>
File: 1411244888712.png (102 KB, 234x255)
102 KB
102 KB PNG
>>107113418
/lit/ here, it's been a wile since I've studded programming so I don't know if this poem I wrote would would actually evaluate.
(defun (meow-p) ()
(if (see-human)
(not food-bowl-full)
(door-closed)
(not caterday)
(not has-chezberger)
(not see-human)
(has-chezberger)
(say meow)
>run meow-p
>meow
>meow
>meow
>meow
>>
File: 1718746521716411.jpg (16 KB, 362x276)
16 KB
16 KB JPG
>>107113418
i'm looking to work on a project that adds folders to the favorite section of the sd-webui-prompt-all-in-one extension
it'd be good to do since i haven't done any python in months, focusing on my c++ class
i just have no fucking clue where to start. extension's source code looks confusing
>>
File: 1760184182370811.mp4 (2.27 MB, 540x960)
2.27 MB
2.27 MB MP4
>>107126339
I'm not such what you're imagining but you're nearly right
;; valid elisp (trailing else)
(defun (meow-p) ()
(if (see-human)
(not food-bowl-full)
(door-closed)
(not caterday)
(not has-chezberger)
(not see-human)
(has-chezberger)
(say meow)))

;; valid common lisp (no trailing else)
(defun (meow-p) ()
(if (see-human)
(not food-bowl-full)
(progn
(door-closed)
(not caterday)
(not has-chezberger)
(not see-human)
(has-chezberger)
(say meow))))

To invoke the function is (meow-p), run meow-p are two variables
>>
>>107125656
>>107125666
Are you sure it is working correctly? It seems to fail on my end every now and then for lengths > 64

For example searching for 67 1s in a bitfield: https://pastebin.com/y7Yean8f
it returns 4294967295/-1, but it should be 62

The problem might be on my side, I have manually monomorphised and translated your code to C, so I would like to cross check this with you.
>>
>>107126445
>procedural but with parenthesis
im still waiting for an example where lisp isnt just a fukken fancy
>>
Vibe coder here. My job is like BA/PM/Dev but I've been taking programming courses but I'm sorta like...what's the point. I can get Claude to give me a rough draft and then just QA later if the results are wrong. I'm never going to be doing anything like actual coding and I'm stuck in fucking SaaS and third party tool land.
>>
>>107126640
>Vibe coder here
wrong thread
wrong board, actually
>>
File: 1724829673358388.png (190 KB, 466x360)
190 KB
190 KB PNG
>>107126633
(define (dot-product a b)
(fold + 0 (zip * a b)))
>>
>>107126702
>i call functions, but with parenthesis bc im special
???
>>
>>107126702
>>107126720
cont
you do realize that youre calling a standard lib similarily to what you would call a c function, right?
its just that the syntax is different
>>
>>107126633
Lisp is a homoerotic language which allows it to have best macros.
>>
>>107126702
>zip *
zipsters... are we back?
>>
>>107126769
its intellectual masturbation with no regards whatsoever given to the underlying physical processes
its the result of a faulty mathematical model.
>we dont have coverage of what programming actually is?
>how bout we reduce programming to what we can describe instead
>thats gonna solve the problem
>>
>>107126623
Whoops you're right, the <128 case isn't checking for a third block.
>>
>>107126796
nu-/sci/-tier schizo post.
>>
File: 1740550996949958.png (447 KB, 627x637)
447 KB
447 KB PNG
>>107126850
Like 50 posts itt is this guy boomerposting between bong hits (not judging, you do you)
>>
>>107126850
>cant answer with a constructed thought?
>just use a saaaaaad homonem and hope people are too retarded to follow

total lispREATRD death
>>
File: 1760927221592538.jpg (71 KB, 336x336)
71 KB
71 KB JPG
Why is object oriented programming bad?
>>
>lisp
>invented by jew
>full of ((())))s
>>
>>107126881
>Why is object oriented programming bad?
its not a job for women
>>
>>107126881
Indirection ig
>>
>>107126807
128+ cases also have some problems.
len 128, solution 106 https://pastebin.com/9MJAFW4e

I guess there are edgecases

Here is a simple Rust procedure I wrote for generating test cases given specific solution. You might want to rewrite it in C and write some units tests.
pub fn generate_buffer(rng: &mut SmallRng, buffer: &mut [u64; BUFF_LEN], len: usize, solution: usize) {
assert!(len >= 1);
assert!(len + solution <= BUFF_LEN * 64);

*buffer = [0; BUFF_LEN];

let mut cur = false;
let mut run = 0;

for i in 0..BUFF_LEN*64 {
let bit_set = if solution > 0 && i == solution - 1 {
false
} else if i >= solution && i < solution + len {
true
} else if len == 1 {
false
} else if run <= 0 {
cur = !cur;
let max = if cur { len - 1 } else { len * 3 };
run = rng.random_range(0..max);
cur
} else {
run -= 1;
cur
};

if bit_set {
buffer[i / 64] |= 1 << (i % 64);
}
}
}
>>
>>107126967
indirect instagrams? Can you elaborate?
>>
claude code is naming my git branch master, will i get cancelled for this some day?
>>
>>107126988
Indirection like for dynamic dispatch and late binding
>>
File: waifus.jpg (768 KB, 1600x1067)
768 KB
768 KB JPG
>>107126881
>Why is object oriented programming bad?
Because 90% of the time in programming, form should follow function and not the other way around.
>>
File: 1506181023008.jpg (131 KB, 720x540)
131 KB
131 KB JPG
>>107126445
>I'm not such what you're imagining
The joke is it will always return true with a deluge of meowing. The site thought the rest of the poem was spam, but once the function is called it leads to the "terminal" being filled with "meow" with all attempts to get it to stop failing.
Also, I'm learning GDscript and I already like it's syntax less then Lisp.
>>
>>107126807
>>107126970
        for (++bk; bk < num_buckets; ++bk) {
const auto right = ~buckets[bk];
ones_right += _tzcnt_u64(right);
if (right != FULL) break;
}

W-what is even happening here?
>>
>>107127054
max_full is min_full + 1, so you have to check 2, and if the first one has a hole, you break.
>>
>>107127085
well, right is inverted so it should be 0
>>
https://github.com/augustss/MicroHs
put haskell in your chips, NOW
>>
>>107127145
does microHS use ghc or something? how does it have required type arguments? or is GHC development just super incompetent?
>>
>>107127054
          u32 ones_right = 0;
for (u32 bk_r = bk + 1; bk_r < num_buckets; ++bk_r) {
u64 right = BIT ? ~buckets[bk_r] : buckets[bk_r];
ones_right += tzcnt(right);
if (right != FULL) break;
}


Also the return case for <128 128+ should be "bk_l < 0 ? idx(bk_l + 1, 0) : idx(bk_l, 64 - ones_left);"
>>
File: 1748189652480001.jpg (396 KB, 1080x1080)
396 KB
396 KB JPG
>>107127145
>no credits for ben lynn's haskell->combinator compiler
>>
File: Figure_1.png (1012 KB, 2048x1203)
1012 KB
1012 KB PNG
>>107127085
Here is how I would implement these two cases.

[spoiler][/spoiler]
} else if (num_bits < 128) {
for (u32 bk = 0; bk < num_buckets - 1; ++bk) {
const auto left = ~buckets[bk];
const auto right = ~buckets[bk + 1];
const auto ones_left = _lzcnt_u64(left);
int sum;

if(right == 0 && bk < num_buckets - 2) {
const auto right2 = ~buckets[bk + 2];
const auto ones_right2 = _tzcnt_u64(right2);
sum = ones_left + 64 + ones_right2;
} else {
const auto ones_right = _tzcnt_u64(right);
sum = ones_left + ones_right;
}

if (sum >= num_bits) return idx(bk, 64 - ones_left);
}
} else {
const auto min_full = (i32)(num_bits) / 64 - 1;
u32 num_full = 0;
for (i32 bk = 0; bk < num_buckets; ++bk) {
constexpr auto FULL = U64_MAX;

if (buckets[bk] == FULL) ++num_full;
else num_full = 0;

if (num_full == min_full) {
u32 ones_left = 0;
const auto bk_l = bk - min_full;
if (bk_l >= 0) {
const auto left = ~buckets[bk_l];
ones_left = _lzcnt_u64(left);
}
u32 ones_right = 0;
const auto bk_r = bk + 1;
if(bk_r < num_buckets) {
const auto right = ~buckets[bk_r];

if(right == 0 && bk_r < num_buckets - 1) {
const auto right2 = ~buckets[bk_r + 1];
ones_right = 64 + _tzcnt_u64(right2);
bk += 1;
} else {
ones_right = _tzcnt_u64(right);
}
}

if (min_full * 64 + ones_left + ones_right >= num_bits) return idx(bk_l, 64 - ones_left);
}
}


Here are plots with my fixes. Noice
>>
>>107127257
I did bk_l and bk_r for <128, will try yours now.
>>
File: Figure_1.png (674 KB, 1666x910)
674 KB
674 KB PNG
>>107127257
Improved visibility
>>
>>107127295
Once you fix and test it your own way, you can send me whole code again and I will replace it in benchmark. But I imagine it won't change much.
>>
>>107127173
>does microHS use ghc or something?
It's optional.
>how does it have required type arguments?
It's simpler. It doesn't have threads and misses like half the runtime.
>or is GHC development just super incompetent?
GHC is (xbox mclarge hueg) BIG and the typechecker is like half of it.
>>
>>107127327
ok so how does microhs have required type arguments and a whole host of other type checker extensions
>>
>>107127336
It's smaller and it's made by
https://en.wikipedia.org/wiki/Lennart_Augustsson
the guy that made the first Haskell compiler and definitely made more Haskell compilers than anybody else and now that he's retired he made another compiler for fun.
>>
>>107125540
shaggin' me NaN
>>
>>107127305
Also changed the <64 shifting loop, idk if that'll be better.
    if (num_bits < 64) {
for (u32 bk = 0; bk < num_buckets - 1; ++bk) {
const auto left = BIT ? buckets[bk] : ~buckets[bk];
if (popcnt(left) >= num_bits) {
u32 numb = num_bits;
u64 bitmap = left;
u64 runs = bitmap;
u32 sh = 1;
while (numb > 1) {
u32 step = numb >> 1;
runs &= (bitmap >> step);
bitmap &= (bitmap >> step);
numb -= step;
}
if (runs) {
const auto bit = tzcnt(runs);
return idx(bk, bit);
}
}
const auto right = BIT ? ~buckets[bk + 1] : buckets[bk + 1];
const auto ones_left = lzcnt(~left);
const auto ones_right = tzcnt(right);
if (ones_left + ones_right >= num_bits) return idx(bk, 64 - ones_left);
}
const auto bk = num_buckets - 1;
const auto last = BIT ? buckets[bk] : ~buckets[bk];
if (popcnt(last) >= num_bits) {
u32 numb = num_bits;
u64 bitmap = last;
u64 runs = bitmap;
u32 sh = 1;
while (numb > 1) {
u32 step = numb >> 1;
runs &= (bitmap >> step);
bitmap &= (bitmap >> step);
numb -= step;
}
if (runs) {
const auto bit = tzcnt(runs);
return idx(bk, bit);
}
}
} else if (num_bits < 128) {
>>
>>107127392
    } else if (num_bits < 128) {
for (i32 bk = 0; bk < num_buckets; ++bk) {
constexpr auto FULL = BIT ? U64_MAX : 0;
if (buckets[bk] == FULL) {
u32 ones_left = 0;
const auto bk_l = bk - 1;
if (bk_l >= 0) {
const auto left = BIT ? ~buckets[bk_l] : buckets[bk_l];
ones_left = lzcnt(left);
}
u32 ones_right = 0;
const auto bk_r = bk + 1;
if (bk_r < num_buckets) {
const auto right = BIT ? ~buckets[bk_r] : buckets[bk_r];
ones_right = tzcnt(right);
}
if (64 + ones_left + ones_right >= num_bits) //
return bk_l < 0 ? idx(bk_l + 1, 0) : idx(bk_l, 64 - ones_left);
}
}
} else {
const auto min_full = i32(num_bits) / 64 - 1;
u32 num_full = 0;
for (i32 bk = 0; bk < num_buckets; ++bk) {
constexpr auto FULL = BIT ? U64_MAX : 0;
if (buckets[bk] == FULL) ++num_full;
else num_full = 0;
if (num_full == min_full) {
u32 ones_left = 0;
const auto bk_l = bk - min_full;
if (bk_l >= 0) {
const auto left = BIT ? ~buckets[bk_l] : buckets[bk_l];
ones_left = lzcnt(left);
}
u32 ones_right = 0;
for (u32 bk_r = bk + 1; bk_r < num_buckets; ++bk_r) {
const auto right = BIT ? ~buckets[bk_r] : buckets[bk_r];
ones_right += tzcnt(right);
if (right != FULL) break;
}
if (min_full * 64 + ones_left + ones_right >= num_bits)
return bk_l < 0 ? idx(bk_l + 1, 0) : idx(bk_l, 64 - ones_left);
}
}
}
return U32_MAX;
>>
They offered to raise my work hours to 8h from 6h in exchange for a 33% increase in salary at my programmer job, would you take it?
>>
>>107127434
I had the same offer, took it, and now I slack off 2 more hours. Free money.
>>
>>107127434
>33
they're freemasons dont do it
>>
File: h-cube.png (159 KB, 900x444)
159 KB
159 KB PNG
>>107127434
>raise workhours from 8 to 6
>>
>>107127457
Read it again
>>
>>107127528
ah shit
time to get some zizz i guess
>>
File: xzibit.png (250 KB, 538x1043)
250 KB
250 KB PNG
>>107127528
also yeah, its worth it
33% more time doing nothing for 33% more pay is always worth it
>>
>>107127449
>>107127634
ignore these feds who want you to slave away
33% increase for 25% increase in time is nothing, it's like 6% better pay to waste 2h of your life if you don't need the extra cash
>>
File: sadd.jpg (32 KB, 600x482)
32 KB
32 KB JPG
im the cpp anon from the other thread, why is python so disorderly and unruly. I think... i think i miss my cpp syntax, i need my curly braces and semicolons :(
>>
>>107127673
really dumb frogposter
>>
File: 1665.jpg (21 KB, 460x460)
21 KB
21 KB JPG
>>107127653
look
the only difference is the ip anon will be shitposting from during that time
lets not fukken kid ourselves
>>
>>107127681
aren't they all?
>>
>>107127689
all the more reason to tell them
they probably don't even understand
>>
File: pepe-front-n.jpg (71 KB, 609x639)
71 KB
71 KB JPG
>>107127689
no
take that back
>>
File: 1762437010476.jpg (76 KB, 854x366)
76 KB
76 KB JPG
>>107113418
added the auto gen
>>
>>107127305
The new shift loop seems faster, up to 2x in the case of num_bits 32 specifically.
I cleaned it up a bit:
          auto bucket = left;
auto runs = left;
auto num_b = num_bits;
while (num_b > 1) {
const auto step = num_b >> 1;
runs &= (bucket >> step);
bucket &= (bucket >> step);
num_b -= step;
}
if (runs) {
const auto bit = tzcnt(runs);
return idx(bk, bit);
}
>>
File: 1749950171473863.png (85 KB, 304x360)
85 KB
85 KB PNG
>>107127689
stay mad, frog is here to stay fren.
>>
>>107127707
>>107127736
>i'll wait a bit before replying again so he doesn't realise it's me
>>
>>107127392
>>107127403
>>107127721
len 64, sol 170
https://pastebin.com/RPLr4mdh
got 4294967295
>>
File: 1729598501589953.png (512 KB, 750x1000)
512 KB
512 KB PNG
>>107127755
retard nigga i have sex with your mom nipple lasy night motherfucker
>>
>>107127755
ulost.com.negroe.il
>>
>>107127799
Oh rip let's just use your <128
>>
File: thinking-emoji-sk8t3r.png (1.05 MB, 1024x1024)
1.05 MB
1.05 MB PNG
Do you guys know any based words we can spell out with hex numbers?

Like CAFEBABE (Java's class file signatures) or BEEF.

I wanna write a program that generates them, but I have no idea where to start...
>>
>>107127799
I ran an actual tester on it, and had to fix case 3 again.
  } else {
const auto min_full = i32(num_bits) / 64 - 1;
u32 num_full = 0;
for (i32 bk = 0; bk < num_buckets; ++bk) {
constexpr auto FULL = BIT ? U64_MAX : 0;
if (buckets[bk] == FULL) ++num_full;
else num_full = 0;
if (num_full == min_full) {
u32 run = min_full * 64;
u32 ones_left = 0;
const auto bk_l = bk - min_full;
if (bk_l >= 0) {
const auto left = BIT ? ~buckets[bk_l] : buckets[bk_l];
ones_left = lzcnt(left);
}
run += ones_left;
for (u32 bk_r = bk + 1; bk_r < num_buckets; ++bk_r) {
const auto right = BIT ? ~buckets[bk_r] : buckets[bk_r];
if (right == 0) run += 64;
else {
run += tzcnt(right);
break;
}
if (run >= num_bits) break;
}
if (run >= num_bits) return bk_l < 0 ? idx(bk_l + 1, 0) : idx(bk_l, 64 - ones_left);
}
}
>>
where using select(), do i just add all my various fd's into FD_SET and stick that in a loop? how do i prevent that loop from being blocked by a read command? say for a chat server that should continuously loop through an FD_SET, but also wait for input from user?
>>
>>107128509
switch to base64. the jew fears base64 words.
NIGGER HEIL HITLER
>>
>>107128509
>I wanna write a program that generates them, but I have no idea where to start...
1. create a character mapping from any letter to a hex symbol
2. find some dictionary of words (optionally: filter out words with characters you can't map to a hex symbol)
3. roll for a word from the dictionary and translate using the character mapping from 1
>>
>>107128520
Select is fun, but ultimately more trouble than it's worth. Just put all your various io needs on different threads.

>>107128509
grep ^[0-9a-fA-F]*$ /usr/share/dict/words
>>
>>107128519
len 64, take 1, sol 159
https://pastebin.com/kG4itiF3
find_sequence3.c: 4294967295
>>
>>107128603
oh that's a good idea. i guess i could just use two threads and end up with appropriate FD's since they are shared. i'll give that a shot.
>>
>>107128608
I'm using your <128, mine was broken.
>>
File: sortvis_KhQozVrBPg.mp4 (3.15 MB, 1706x1022)
3.15 MB
3.15 MB MP4
making a sorting algo visualizer
>>
>>107128851
Nice. egui? Does it play sound?
>>
>>107128888
egui through eframe and yeah it does sound, eventually im going to make it play sound files so i can give every sorting algo its own instrument
>>
File: NOOOOOOOOOOOOOOOOO.jpg (9 KB, 217x265)
9 KB
9 KB JPG
>>107122838
>>107122855
>Can't see the file

G-g-g-GHOST CODE?!
>>
>>107128851
Hey I did the same the other day but I dumped the data into Matlab/octave 2d plots to measure the time/input size.
>>
>>107113418
Hiya TPS!

Today I'm mostly brushing up on my C and C++, there's a little programming comp at my college tomorrow and I wanna participate.

Otherwise, been messing with sorting functions lately.
>>
>>107125440
Wamr (webassembly micro runtime) is a wasm runtime made writtin in C for embedded and SGX enclaves.
Technically you are not running wasm directly on the microcontroller (but the interpreter might fit), you are running a precompiled AOT binary, but it will have all the safety of wasm (AKA errors can be handled and store a stacktrace without a debugger like I mentioned), and wasm also helps reduce determinism issues (possibly finding issues in the simulator without needing to debug it on real hardware, but personally, I would rather simulate it as a native binary when I am actually debugging the code, BUT you need a simulator to run the code that runs outside of Wasm, but it depends on how much the RTOS simulator holds your hand, maybe the RTOS simulator skips the step of writing your own simulator, but debugging wasm is not without pain if you don't have sanitizers...)
I honestly don't know what RTOS really means, and WAMR supports a bunch of stuff for embedded, not sure if it's all RTOS or not, and I just figured out that RTOS are are similar to linux (address sanitizer?!?), and it works on RP2040 (it shouldn't be that surprising since it is an ARM cpu), perhaps there could be an RTOS that could work for 8/16bit CPU like the Arduino ATmega (wasm cant run on AVR), and I also found out that LLVM supports AVR, but I don't see if rust RTOS supports AVR (ATmega does have threads), and I bet it's not worth it due to missing too many abstractions compared to bigger RTOS implementations.
>>
File: 1755139208651347.png (119 KB, 480x360)
119 KB
119 KB PNG
I swear the js/ts ecosystem is made to be as infuriating and annoying as possible. Jesus Christ.
>>
File: Figure_1.png (1.19 MB, 2166x1193)
1.19 MB
1.19 MB PNG
>>107128519
>>107128746
Alright. It's on the plot as find_sequence3.c

And here is my attempt. I tried to simply everything and it seems to be even faster for longer lengths. Not so much for <64 cases, but it might be just a difference in compilation. I tried to compile both with -march=native so we get all these popcnt etc opcodes. But I'm too tired to follow each assembly output to figure it out. I tried your way of doing this but I measured no difference. I also tried precomputing tables for optimal shifts but again that added as much overhead as it saved. Doing dozen or two of 1-bit shifts in a row is just very fast.

pub extern "C" fn kiss(buckets: *const u64, num_buckets: u32, length: u32) -> u32 {
let buckets = unsafe { slice::from_raw_parts(buckets, num_buckets as usize) };

let mut run = 0;
for (bid, &bucket) in buckets.iter().enumerate() {
let bid = bid as u32;
let trailing = bucket.trailing_ones();

if run + trailing >= length {
return bid * 64 - run;
}

if trailing == 64 {
run += 64;
} else {
run = bucket.leading_ones();

if length < 64 && bucket.count_ones() as i32 - run as i32 - trailing as i32 >= length as i32 {
let mut bits = bucket;
for _ in 0..length-1 {
bits &= bits >> 1;
}

if bits != 0 {
return bid * 64 + bits.trailing_zeros();
}
}
}
}

if run >= length {
return num_buckets * 64 - run;
}

u32::MAX
}
>>
>>107129366
>I tried your way of doing this but I measured no difference
By that I mean your way of doing the shifts(I am not sure even why they work)
I also tried splitting it into two cases but no difference still. Maybe if I you translate it to C we can see if it's just language difference, but it's time to sleep for me already.
>>
>>107129366
Very nice, might be worth it to combine it with the <64 case.
>>
>>107129102
nevermind ignore address sanitizer, that's only for simulators.
I think one person got kasan running on one very specific RTOS and arm CPU (NXP K22FN512)
Undefined behavior sanitizer works on everything (you could get it working without RTOS if you just fill in the function stubs, I saw from a SerenityOS video).
>>
>>107113418
>...the hell is OP
Favorite book you use while...programming games on...WYSWYG IDE? Also what's your IDE,favorite? what do you make with it?
>>
>>107129679
good morning sir
>Also what's your IDE,favorite?
eclipse ide
>what do you make with it?
enterprise java software

>programming games
waste of time
>>
File: cmaketrannies.jpg (89 KB, 687x234)
89 KB
89 KB JPG
Why do they say that if nobody in that stupid reddit thread has posted a real solution that isn't some unhinged 500 CMakeLists.txt niggerbabble?
>>
Saaaaar...
>>
File: 1762471163607.jpg (75 KB, 815x376)
75 KB
75 KB JPG
>>
File: name saars.webm (3.8 MB, 800x700)
3.8 MB
3.8 MB WEBM
>>
>>107130944
>a jeet-code tier respondant
gimme abreak
>>
>https://xmake.io/examples/cpp/cxx-modules.html
What's the catch?
>>107131066
kek
>>
desu by itself like that makes no sense nano desu
NOT desu doesn't either desu wa
>>
>>107124477
you've never been banned for racism
>>
>doing leetcode problem
>get expected solution
>works fine solo in any test case
>copy code into leetcodes editor
>somehow get buffer overflow on a testcase that I tested myself and was fine
>>
rust is the future you're just upset a new generation of eunuchs is ready to replace all you crusty lame unix flavored eunuchs
and you're BIG MAD to see them use the very same trickery you guys used to push away pascal and basic and fortran
>>
>>107131494
what tricks?
incorrect code?
>>
File: cider-enlighten-mode.gif (476 KB, 479x577)
476 KB
476 KB GIF
>What are you working on?
I got chatgpt to write me a song about SQL in Japanese that I could easily import into VoiceVox. The lyrics it came up with are okay, but it utterly failed at actually creating a .ust file that includes them, even after repeated prodding. So now I'm writing a program that maps the lyrics jippity gives me to a simple melody.
>>
>>107131494
if rust is future then why can't it just let me do what I want the way C++ does?
>>
>>107131729
There is nothing you can do in C++ that you can't do I'm Rust.
>>
>>107131763
>I'm
*in
>>
>>107131763
I can write a naked function in C++ that has both inline assembly and plain C++ code in it, technically non-standard, maybe even UB according to standard, but Rust doesn't even have a standard and actively bans this for no reason other than their own incompetence.
>inb4 why would you need this
Fuck off retarded shill.
>>
>>107131778
There is no naked functions in standard C++
>>
>>107131796
There are no standards in Rust, everything is a gotcha, somehow to push their own tranny axewound agenda, and "own" the chuds in some way even at their own detriment.
I'd go as far as say that the only standard Rust ever has hopes of attaining is that of standard deviation in regards to the rule of 41%
>>
>>107131808
>*incompressible /pol/ ramble*
Midwit detected
>>
>>107129464
>By that I mean your way of doing the shifts(I am not sure even why they work)
nta but
if length = 4
you & the bucket with itself, but bit shifted by 1 length - 1 times

00111100
00011110
00001111
00000111
-------------
00000100 -> is not zero, that means 1's are contiguous


00101100
00010110
00001011
00000101
-------------
00000000 -> is zero, that means 1's are not contiguous.


theres a problem with his offset computations though
001111000000
000111100000
000011110000
000001111000
-------------------
000001000000


return bid * 64 + bits.trailing_zeros();
0*64 + 6 != 2


also what about this:
00111100001111000000
00011110000111100000
00001111000011110000
00000111100001111000
-------------------------
00000100000001000000

if you massage the trailing zeroes trick to work, this example will give you the wrong offset. its gonna give you the second one
>>
>>107131819
Your concession was accepted 2 posts ago and the notification daemon responsible for making you aware of this was written in Rust, due to security implications of immediate awareness of ones own retarded behavior, we delayed this message.
>>
>>107131832
ah shit
>endianness
'completely forgot about that
i take back the incorrectness claims
>>
File: Figure_1.png (612 KB, 2560x1336)
612 KB
612 KB PNG
>>107127392
>>107129464
Also here is absolute time loglog graph, with solution fixed at 12345 position to keep times even. It might give a little better understanding of the characteristics of these functions instead of relative times.
>>
>>107132063
have you tried something like this?
position seek_set(unsigned long bucket)
{
position rst;
rst.zeroes = __builtin_ctz(bucket);
rst.ones = __builtin_ctz(~(bucket >> rst.zeroes));
return (rst);
}

i think this could flatten the curve for low count spaces or data heavily loaded with small set regions
i think, im currently writing it, i have yet to see how thats gonna behave
>>
>>107132125
Post the code and I will plug it in. I'm going to take care of work now so I won't contribute much right now. I'm out of ideas anyway.
>>
>>107132144
its gonna take me a moment.
if the thread dies before i post, i will post in the next /dpt/
>>
File: blacked.jpg (120 KB, 720x540)
120 KB
120 KB JPG
Isn't it weird how rust shilling comes and goes in waves? They spam about rust for a bit, then total silence immediately after getting btfo? Who benefits?
>>
>>107132351
Get a job.
>>
>>107132361
I am at my job, what now?
What about rustrannies? Are you going to tell me that 15k job positions that in fact are available already are filled by these drooling unemployable nocoders?
>>
>>107132351
>after getting btfo
by whom, some cnile that spams fallacies and always tries to change subject whenever he can't answer counter a simple point?



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.