1. C++ / Говнокод #25957

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    #include <iostream> #include <cmath> #include <iomanip> #include <random> using namespace std; 
    int main()
    {
        setlocale(LC_ALL, "Rus");
        double n; cout << "Введите точность вычисления: "; cin >> n;
        while (n < 0.000001 || n > 1)
        {
            cout << "Веденное не соответствует условию" << "\nВведите точность вычислений: " << endl; cin >> n;
        }
        random_device generator;  uniform_real_distribution<double> distribution(-700, 700); //потому что функция "sinh" не считает > 700 double x = distribution(generator)  cout << "На множестве R выбран x, равный: " << x << "\n";
        double sum = 0.0 double a = x; double t = 1;
        while (abs(a) >= n)
        {
            sum += a; a *= (x * x / ((t + 1) * (t + 2))); t += 2;
        } 
        double func = sinh(x);  double diff = abs(sum - func); cout << setprecision(ceil(log10(1 / n))) << "Результат функции: " << func <<"\nРезультат просчета ряда: " << sum << endl; cout << "Погрешность составляет: " << diff << endl;   
        return 0;

    Brutallprincess, 16 Октября 2019

    Комментарии (10)
  2. C++ / Говнокод #25956

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    #include <iostream>
    #include <cmath>
    #include <iomanip>
    #include <random>
    using namespace std;
     
    int main()
    {
        setlocale(LC_ALL, "Rus");
        double n;
        cout << "Введите точность вычисления: ";
        cin >> n;
     
        while (n < 0.000001 || n > 1)
        {
            cout << "Веденное не соответствует условию" << "\nВведите точность вычислений: " << endl;
            cin >> n;
        }
     
        //Рандомные числа с промежутком
        random_device generator;
        uniform_real_distribution<double> distribution(-700, 700); //потому что функция "sinh" не считает > 700
        double x = distribution(generator);
        cout << "На множестве R выбран x, равный: " << x << "\n";
     
        //Подсчёт формулы
        double sum = 0.0;
        double a = x;
        double t = 1;
        while (abs(a) >= n)
        {
            sum += a;
            a *= (x * x / ((t + 1) * (t + 2)));
            t += 2;
        }
     
        //Функция, сравнение, погрешность
        double func = sinh(x);
        double diff = abs(sum - func);
        cout << setprecision(ceil(log10(1 / n))) << "Результат функции: " << func <<"\nРезультат просчета ряда: " << sum << endl;
        cout << "Погрешность составляет: " << diff << endl;   
        return 0;

    Brutallprincess, 16 Октября 2019

    Комментарии (0)
  3. C++ / Говнокод #25950

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    #include "pch.h"
    #include <iostream>
    #include <conio.h>
    #include <stdlib.h>
    #include <ctime>
    
    using namespace std;
    
    int main()
    {
    	setlocale(0, "rus");
    	int n, a[1000], max, c;
    	cout << "число элементов: "; cin >> n;
    	srand(time(0));
    	
    	cout << "\nчисла массива:\n";
    	for (int i = 0; i < n; i++) {
    		a[i] = rand() % 2000 -1000;
    		cout << a[i] << " ";
    		if (i == 0) max = abs(a[i]); else if (abs(a[i]) > max) max = abs(a[i]);
    	}
    	cout << "\n\nабс. максимум = " << max << endl;
    
    	for (int i = 0; i < n; i++) {
    		for (int j = n-1; j > 0; j--) {
    			if (a[j - 1] < a[j]) {
    				c = a[j - 1];
    				a[j - 1] = a[j];
    				a[j] = c;
    			}
    		}
    	}
    
    	cout << "\nотсортированный массив:\n";
    	for (int i = 0; i < n; i++) {
    		cout << a[i]<<" ";
    	}
    
    	_getch();
    	return 0;
    }

    maxrbs, 15 Октября 2019

    Комментарии (1)
  4. Java / Говнокод #25947

    −3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    99. 99
    import java.util.Random;
    public class Main {
        public static void main(String[] args) {
            Galaxy g = new Galaxy(3,77,34);
            g.start();
        }
    }
    class Galaxy extends Thread {
        private int min = 1;
        private int max = 100;
        private final int step = 5;
        private final int TIME = 1000;
        volatile private int a, b, c;
        Galaxy(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }
        public void start() {
            Thread t = new Thread(this, "one");
            t.start();
            Thread t2 = new Thread(this, "two");
            t2.start();
            Thread t3 = new Thread(this, "three");
            t3.start();
        } @Override
        public void run() { while(true) { try {
                    Thread.sleep(new Random().nextInt(TIME));
                    if(currentThread().getName().equals("one")) {
                        if(new Random().nextInt(2) == 1 && a > 0)
                            a--;
                        else {
                            if (a < max)
                                a++;
                        }
                        int var = a;
                        if(b == var || (b-1) == var || (b+1) == var)
                            if((b+step) > max)
                                b-=step;
                            if((b-step) < min)
                                b+=step;
                        if(c == var || (c-1) == var || (c+1) == var)
                            if((c+step) > max)
                                c-=step;
                            if((c-step) < min)
                                c+=step;
                    }
                  if(currentThread().getName().equals("two")) {
                        if(new Random().nextInt(2) == 1 && b > 0)
                            b--;
                        else {
                            if(b < max)
                                b++;
                        }
                        int var = b;
                        if(a == var || (a-1) == var || (a+1) == var) {
                            if((a+step) > max)
                                a-=step;
                            if((a-step) <= min)
                                a+=step;
                        }
                        if(c == var || (c-1) == var || (c+1) == var) {
                            if((c+step) > max)
                                c-=step;
                            if((c-step) <= min)
                                c+=step;
                        }
                    }
                   if(currentThread().getName().equals("three")) {
                        if(new Random().nextInt(2) == 1 && c > 0)
                            c--;
                        else {
                            if(c < max)
                                c++;
                        }
                        int var = c;
                        if(a == var || (a-1) == var || (a+1) == var) {
                            if((a+step) > max)
                                a-=step;
                            if((a-step) <= min)
                                a+=step;
                        }
                        if(b == var || (b-1) == var || (b+1) == var) {
                            if((b+step) > max)
                                b-=step;
                            if((b-step) <= min)
                                b+=step;
                        }
                    }
                    for(int i = min; i <= max; i++) {
                        int p = 0;
                        if(i == a || i == b || i == c)
                            p = 1;
                        System.out.print(p);
                    }
                    System.out.println();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }}}}

    После запуска ждал 10 минут. Но они так и не сблизились. Программа словно остерегается сближения. Как живая.
    Рашан ИИ!

    codershitter, 14 Октября 2019

    Комментарии (9)
  5. PHP / Говнокод #25946

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    <?php
    
    define('MAX_NUMBER', 70);
    
    function factorial($value) {
        return array_reduce(range(1, $value), function($carry,$item){return $carry*$item;}, 1);
    }
    
    function R($value) {
        return floor(2*sqrt(log(($value))));
    }
    
    function make_chain($start, $length) {
        $chain['start'] = $start;
        for($i = 0; $i < $length; ++$i) {
            $hash = factorial($start);
            echo ">>> $start! == $hash\n";            // диагностическое сообщение
            $start = R($hash);
            if($start == 0) break;
        }
        $chain['end'] = $hash;
        echo "Chain from ${chain['start']} to ${chain['end']} is ready.\n"; // диагностическое сообщение
        return $chain;
    }
    
    function make_chains($count, $length) {
        $chains = [];
        mt_srand();
        for($i = 0; $i < $count; ++$i) {
            $number = mt_rand(0, MAX_NUMBER - 1);                // начинаем цепочку с псевдослучайного слова
            $chain = make_chain($number, $length);
            $hash = $chain['end'];                               // используем конец найденной цепочки как индекс для быстрого поиска
            if(!isset($chains[$hash])) $chains[$hash] = [];      // если такого хэша не было в корзине, инициализируем её
            if(!in_array($chain['start'], $chains[$hash])) {     // проверяем на дубли
                $chains[$hash][] = $chain['start'];              // добавляем начало цепочки в корзину
            }
        }
        return $chains;
    }
    
    function find_hash_in_basket($needle, $haystack_start, $haystack_end) {
        echo "Роемся в цепочке от $haystack_start до $haystack_end.\n";       // диагностическое сообщение
        $current_number = $haystack_start;
        do {
            $current_hash = factorial($current_number);         // <-- сюда вставьте нужную хэш-функцию
            if($current_hash <= $needle && $needle <= $current_hash * ($current_number + 1)) {
                 return $current_number;                  // нашли
            }
            $current_number = R($current_hash);  // роем в глубину
        } while($current_hash !== $haystack_end);
        return false; // не нашли
    }
    
    function search_hash($hash, $chains, $length) {
        $current_hash = $hash;
        for($i = 0; $i < $length; ++$i) {
              if(isset($chains[$current_hash])) {                // нашли хэш в одной из корзин
                  echo "Лезем в корзину $current_hash.\n";       // диагностическое сообщение
                  foreach($chains[$current_hash] as $start) {    // роемся в корзине
                      $result = find_hash_in_basket($hash, $start, $current_hash); // пытаемся найти в каждой из цепочек корзины
                      if($result) {
                          return $result;                        // конец поиска
                      }
                  }
              }
              $next_number = R($current_hash);             // копаем в глубину
              $current_hash = factorial($next_number);
        }
        return false; // не нашли
    }
    
    ///////////////////// ПРИМЕР //////////////////////////////////
    
    
    $chains = make_chains(10, 5);
    echo "Радужные таблицы готовы.\n";
    var_dump($chains);
    
    $hash = 721;
    echo "Пытаемся обратить $hash.\n";
    $number = search_hash($hash, $chains, 5);
    echo $number . "! <= $hash <= " . ($number+1) . "!\n";

    Безумная идея: использовать радужные таблицы для обращения математических функций. Например, радужная таблица для факториала:
    http://ideone.com/Q22EXy

    ropuJIJIa, 13 Октября 2019

    Комментарии (11)
  6. PHP / Говнокод #25945

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    <?php
    
    function word_by_index($index, $dicts) {
        $sizes = array_map(function($val){return count($val);}, $dicts); // получаем размеры каждого словаря
        $result = '';
        foreach($sizes as $key=>$size) {
            $result .= $dicts[$key][$index % $size]; // сцепляем слово из частей
            $index = floor($index / $size);
        }
        return $result;
    }
    
    function R($hash, $dicts, $total) {
        $index = gmp_intval(gmp_mod(gmp_init($hash, 16), $total));
        return word_by_index($index, $dicts); 
    }
    
    function make_chain($start, $length, $dicts, $total) {
        $chain['start'] = $start;
        for($i = 0; $i < $length; ++$i) {
            $hash = md5($start);                    // <-- сюда вставьте нужную хэш-функцию
            // echo ">>> $hash : $start\n";            // диагностическое сообщение
            $start = R($hash, $dicts, $total);
        }
        $chain['end'] = $hash;
        echo "Chain from ${chain['start']} to ${chain['end']} is ready.\n"; // диагностическое сообщение
        return $chain;
    }
    
    function make_chains($count, $length, $dicts) {
        $sizes = array_map(function($val){return count($val);}, $dicts); // получаем размеры каждого словаря
        $total = array_reduce($sizes, function($carry,$item){return $carry*$item;}, 1); // произведение размеров словарей
        $chains = [];
        mt_srand();
        for($i = 0; $i < $count; ++$i) {
            $word = word_by_index(mt_rand(0, $total - 1), $dicts);  // начинаем цепочку с псевдослучайного слова
            $chain = make_chain($word, $length, $dicts, $total);
            $hash = $chain['end'];                               // используем конец найденной цепочки как индекс для быстрого поиска
            if(!isset($chains[$hash])) $chains[$hash] = [];      // если такого хэша не было в корзине, инициализируем её
            if(!in_array($chain['start'], $chains[$hash])) {     // проверяем на дубли
                $chains[$hash][] = $chain['start'];              // добавляем начало цепочки в корзину
            }
        }
        return $chains;
    }
    
    function find_hash_in_basket($needle, $haystack_start, $haystack_end, $dicts, $total) {
        echo "Роемся в цепочке от $haystack_start до $haystack_end.\n";       // диагностическое сообщение
        $current_word = $haystack_start;
        do {
            $current_hash = md5($current_word);         // <-- сюда вставьте нужную хэш-функцию
            if($current_hash === $needle) {
                 return $current_word;                  // нашли слово, хэш от которого равен заданному
            }
            $current_word = R($current_hash, $dicts, $total);  // роем в глубину
        } while($current_hash !== $haystack_end);
        return false; // не нашли
    }
    
    function search_hash($hash, $dicts, $chains, $length) {
        $sizes = array_map(function($val){return count($val);}, $dicts); // получаем размеры каждого словаря
        $total = array_reduce($sizes, function($carry,$item){return $carry*$item;}, 1); // произведение размеров словарей
        $current_hash = $hash;
        for($i = 0; $i < $length; ++$i) {
              if(isset($chains[$current_hash])) {                // нашли хэш в одной из корзин
                  echo "Лезем в корзину $current_hash.\n";       // диагностическое сообщение
                  foreach($chains[$current_hash] as $start) {    // роемся в корзине
                      $result = find_hash_in_basket($hash, $start, $current_hash, $dicts, $total); // пытаемся найти в каждой из цепочек корзины
                      if($result) {
                          return $result;                        // конец поиска
                      }
                  }
              }
              $next_word = R($current_hash, $dicts, $total);             // копаем в глубину
              $current_hash = md5($next_word);
        }
        return false; // не нашли
    }
    
    ///////////////////// ПРИМЕР //////////////////////////////////
    
    $dicts= array(
          array('свино',  'овце', 'тигро', 'косатко', 'зубро', 'волко', 'кото'),
          array('собака', 'бык',  'лев',   'дельфин', 'бизон')
    );
    
    $chains = make_chains(15, 15, $dicts);
    echo "Радужные таблицы готовы.\n";
    var_dump($chains);
    
    $hash = '360629d3cf05cee0240a23e1251c58a0';
    echo "Пытаемся обратить $hash.\n";
    $word = search_hash($hash, $dicts, $chains, 15);
    echo "$hash is reversed to $word.\n";

    По просьбам трудящихся.

    Выхлоп на Ideone:
    http://ideone.com/otdCDg

    ropuJIJIa, 13 Октября 2019

    Комментарии (25)
  7. Куча / Говнокод #25941

    −1

    1. 1
    IT Оффтоп #24

    #1: https://govnokod.ru/18142 https://govnokod.xyz/_18142
    #2: https://govnokod.ru/18378 https://govnokod.xyz/_18378
    #3: https://govnokod.ru/19667 https://govnokod.xyz/_19667
    #4: https://govnokod.ru/21160 https://govnokod.xyz/_21160
    #5: https://govnokod.ru/21772 https://govnokod.xyz/_21772
    #6: https://govnokod.ru/24063 (потёр пидор сракер) https://govnokod.xyz/_24063
    #7: https://govnokod.ru/24538 https://govnokod.xyz/_24538
    #8: https://govnokod.ru/24815 (потёр пидор сракер) https://govnokod.xyz/_24815
    #9: https://govnokod.ru/24867 https://govnokod.xyz/_24867
    #10: https://govnokod.ru/25328 https://govnokod.xyz/_25328
    #11: https://govnokod.xyz/_25436 https://govnokod.ru/25436 (потёр пидор сракер)
    #12: https://govnokod.xyz/_25471
    #13: https://govnokod.xyz/_25590 (потёр пидор сракер)
    #14: https://govnokod.xyz/_25684
    #15: https://govnokod.xyz/_25694
    #16: https://govnokod.xyz/_25725
    #17: https://govnokod.xyz/_25731
    #18: https://govnokod.xyz/_25762
    #19: https://govnokod.xyz/_25767
    #20: https://govnokod.xyz/_25776
    #21: https://govnokod.xyz/_25798
    #22: https://govnokod.xyz/_25811
    #23: http://govnokod.ru/25863 https://govnokod.xyz/_25863

    syoma, 12 Октября 2019

    Комментарии (534)
  8. Куча / Говнокод #25937

    −1

    1. 1
    Кто готов встречу в Минске на выходных 2-4 ноября?

    guestinxo, 11 Октября 2019

    Комментарии (130)
  9. C++ / Говнокод #25930

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    // File icontact.h
    // Describes a contact in the address book
    class IContact
    {
    public:
        virtual ~IContact();
        virtual void ... 
        ... 
        void setContact(const QString& contact);
        ...
    private:
        QString m_contact;
        // ... other fields ...
    };
    
    // File icontact.cpp
    void IContact::setContact(const QString &contact)
    {
        m_contact = contact;
    }

    "Ну и че тут непонятного?" (Senior software developer, 8+ years of experience)

    salamon_style, 11 Октября 2019

    Комментарии (27)
  10. Си / Говнокод #25929

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    // https://jaycarlson.net/2019/09/06/whats-up-with-these-3-cent-microcontrollers/
    // The C code I used for those original MCU tests looked something like this:
    
    volatile int16_t in[25];
    volatile int16_t out[25];
    const int16_t a0 = 16384;
    const int16_t a1 = -32768;
    const int16_t a2 = 16384;
    const int16_t b1 = -25576;
    const int16_t b2 = 10508;
    int16_t z1, z2;
    int16_t outTemp;
    int16_t inTemp;
    void main()
    {
      while(1) {
        _pa = 2;
        for(i=0;i<25;i++)
        {
          inTemp = in[i];
          outTemp = inTemp * a0 + z1;
          z1 = inTemp * a1 + z2 - b1 * outTemp;
          z2 = inTemp * a2 - b2 * outTemp;
          out[i] = outTemp;
        }
        _pa = 0;
      }
    }
    
    // The Padauk code looks like this:
    
    WORD in[11];
    WORD out[11];
    WORD z1, z2;
    WORD pOut, pIn; // these are pointers, but aren't typed as such
    int i;
    void  FPPA0 (void)
    {
      .ADJUST_IC  SYSCLK=IHRC/2    //  SYSCLK=IHRC/2
      PAC.6 = 1; // make PA6 an output
      while(1) {
        PA.6 = 1;
        pOut = out;
        pIn = in;
        i = 0;
        do {
          *pOut = (*pIn << 14) + z1;
          z1 = -(*pIn << 15) + z2
            + (*pOut << 14)
            + (*pOut << 13)
            + (*pOut << 9)
            + (*pOut << 8)
            + (*pOut << 7)
            + (*pOut << 6)
            + (*pOut << 5)
            + (*pOut << 3);
          z2 = (*pIn << 14)
            - (*pOut << 13)
            - (*pOut << 11)
            - (*pOut << 8)
            - (*pOut << 3)
            - (*pOut << 2);
          i++;
          pOut++;
          pIn++;
        } while(i < 11);
        PA.6 = 0;
      }
    }

    > As for the filter function itself, you’ll see that all the multiplies have been replaced with shift-adds. The Padauk part does not recognize the * operator for multiplication; trying to use it to multiply two variables together results in a syntax error. No, I’m not joking.

    j123123, 11 Октября 2019

    Комментарии (58)