Skip to content

Reimplement random_bytes to be consistent with endianness#2

Merged
ysbaddaden merged 1 commit intoysbaddaden:std-merge-secure-random-into-randomfrom
oprypin:random_bytes
Sep 4, 2017
Merged

Reimplement random_bytes to be consistent with endianness#2
ysbaddaden merged 1 commit intoysbaddaden:std-merge-secure-random-into-randomfrom
oprypin:random_bytes

Conversation

@oprypin
Copy link

@oprypin oprypin commented Aug 28, 2017

No description provided.

@ysbaddaden ysbaddaden merged commit bc7611e into ysbaddaden:std-merge-secure-random-into-random Sep 4, 2017
ysbaddaden added a commit that referenced this pull request Dec 6, 2024
Upgrades the IOCP event loop for Windows to be on par with the Polling event loops (epoll, kqueue) on UNIX. After a few low hanging fruits (enqueue multiple fibers on each call, for example) the last commit completely rewrites the `#run` method:

- store events in pairing heaps;
- high resolution timers (`CreateWaitableTimer`);
- block forever/never (no need for timeout);
- cancelling timeouts (no more dead fibers);
- thread safety (parallel timer de/enqueues) for [RFC #2];
- interrupt run using completion key instead of an UserAPC for [RFC #2] (untested).

[RFC #2]: crystal-lang/rfcs#2
ysbaddaden added a commit that referenced this pull request Dec 6, 2024
- Add the `ExecutionContext` module;
- Add the `ExecutionContext::Scheduler` module;
- Add the `execution_context` compile-time flag.

When the `execution_context` flag is set:

- Don't load `Crystal::Scheduler`;
- Plug `ExecutionContext` instead of `Crystal::Scheduler`.
ysbaddaden added a commit that referenced this pull request Dec 9, 2024
- Add the `ExecutionContext` module;
- Add the `ExecutionContext::Scheduler` module;
- Add the `execution_context` compile-time flag.

When the `execution_context` flag is set:

- Don't load `Crystal::Scheduler`;
- Plug `ExecutionContext` instead of `Crystal::Scheduler`.
ysbaddaden added a commit that referenced this pull request Dec 20, 2024
- Add the `ExecutionContext` module;
- Add the `ExecutionContext::Scheduler` module;
- Add the `execution_context` compile-time flag.

When the `execution_context` flag is set:

- Don't load `Crystal::Scheduler`;
- Plug `ExecutionContext` instead of `Crystal::Scheduler`.
ysbaddaden added a commit that referenced this pull request Jan 6, 2025
- Add the `ExecutionContext` module;
- Add the `ExecutionContext::Scheduler` module;
- Add the `execution_context` compile-time flag.

When the `execution_context` flag is set:

- Don't load `Crystal::Scheduler`;
- Plug `ExecutionContext` instead of `Crystal::Scheduler`.
ysbaddaden added a commit that referenced this pull request Jan 7, 2025
- Add the `ExecutionContext` module;
- Add the `ExecutionContext::Scheduler` module;
- Add the `execution_context` compile-time flag.

When the `execution_context` flag is set:

- Don't load `Crystal::Scheduler`;
- Plug `ExecutionContext` instead of `Crystal::Scheduler`.
ysbaddaden added a commit that referenced this pull request Jan 16, 2025
- Add the `ExecutionContext` module;
- Add the `ExecutionContext::Scheduler` module;
- Add the `execution_context` compile-time flag.

When the `execution_context` flag is set:

- Don't load `Crystal::Scheduler`;
- Plug `ExecutionContext` instead of `Crystal::Scheduler` in `spawn`,
  `Fiber`, ...

This is only the skeleton: there are no implementations (yet). Trying to
compile anything with `-Dexecution_context` will obviously fail for the
time being.
ysbaddaden pushed a commit that referenced this pull request Feb 9, 2025
`Tuple#to_a(&)` is an optimized implementation of `Enumerable#to_a(&)` (overriding `Indexable#to_a(&)`).

But the array is wrongly typed. It is impossible to map to a type that's not in the tuple:

```cr
{1}.to_a(&.to_s) # Error: expected argument #2 to 'Pointer(Int32)#[]=' to be Int32, not String
```

Like the original implementations, `Tuple#to_a` must create an array that can hold the output type of the block because that's what it collects. It has nothing to do with the type of the tuple.
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.

2 participants