clang formatted

This commit is contained in:
Rushil Umaretiya 2024-04-18 02:29:54 -04:00
parent c42a9b4418
commit d62a046f5c
No known key found for this signature in database
GPG Key ID: 4E8FAF9C926AF959

22
task.c
View File

@ -177,26 +177,29 @@ void heapify(int i) {
while (!done && (2 * k + 1) < size()) {
int j = 2 * k + 1;
if (j + 1 < size()) {
// two children
task_struct *left = get_task(j);
task_struct *right = get_task(j + 1);
task_struct* left = get_task(j);
task_struct* right = get_task(j + 1);
float left_ratio = (float)left->priority / (float)left->remaining_cycles;
float right_ratio = (float)right->priority / (float)right->remaining_cycles;
float left_ratio =
(float)left->priority / (float)left->remaining_cycles;
float right_ratio =
(float)right->priority / (float)right->remaining_cycles;
if (right_ratio < left_ratio) {
j++;
}
}
task_struct *curr = get_task(k);
task_struct *next = get_task(j);
task_struct* curr = get_task(k);
task_struct* next = get_task(j);
float curr_ratio = (float)curr->priority / (float)curr->remaining_cycles;
float next_ratio = (float)next->priority / (float)next->remaining_cycles;
float curr_ratio =
(float)curr->priority / (float)curr->remaining_cycles;
float next_ratio =
(float)next->priority / (float)next->remaining_cycles;
if (curr_ratio > next_ratio) {
swap(curr->pid, next->pid);
@ -213,7 +216,6 @@ void min_heapify() {
}
}
void print_tasks() {
// DO NOT MODIFY
task_struct* p_task = head;